PRB: C4059 May Be Caused by Errors in OS2DEF.H and PMWIN.H

ID Number: Q66645

6.00 6.00a

OS/2

buglist6.00 buglist6.00a

Summary:

SYMPTOMS

If the header files shipped with the Microsoft OS/2 Programmer's

Toolkit version 1.2 are used when compiling the sample code below

with /AL, the compiler will issue the following warning for the two

assignment statements:

warning C4059: segment lost in conversion

CAUSE

This error is caused by the way certain macros are defined.

RESOLUTION

If the following changes are made to OS2DEF.H and PMWIN.H, the

warnings will not occur:

1. In OS2DEF.H, change line 136 from

#define LOUSHORT(l) ((USHORT)(l))

to the following:

#define LOUSHORT(l) ((USHORT)(ULONG)(l))

2. In PMWIN.H, change line 157 from

#define CHAR1FROMMP(mp) ((UCHAR)(mp))

to the following:

#define CHAR1FROMMP(mp) ((UCHAR)(ULONG)(mp))

STATUS

The first change has already been made to the include files that

shipped with Microsoft C version 6.0; the second change has not

been made. Microsoft has confirmed this to be a problem with C

version 6.0 and 6.0a. We are researching this problem and will post

new information here as it becomes available.

More Information:

Sample Code

-----------

/* Compile options needed: /AL

*/

#include <os2def.h>

#include <pmwin.h>

void test(MPARAM mp1);

void test(MPARAM mp1)

{

USHORT i;

UCHAR c;

i=LOUSHORT(mp1);

c=CHAR1FROMMP(mp1);

}

Additional reference words: 6.00 6.00a