TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Paul Edwards
from: Peter Fitzsimmons
date: 1995-01-04 06:06:16
subject: watcom 10.0a bug

Yup,  that's a bug.  I changed your program around to show exactly what the
problem is.  It works correctly with IBM Cset++.  I'll send it to watcom.

 PE>   if (memcmp(&myptr, &def->x, 4) != 0)

This through me for a while --- I think what you really meant was this:

 if(memptr != def->x)


 #include 
 #include 

 typedef struct mystruct
 {
     void * _Seg16 x;
 }MYSTRUCT;

 MYSTRUCT abc;
 MYSTRUCT * _Seg16 def = NULL;
 char     * _Seg16 myptr = NULL;

 long g = 0x12345678L;

 int main(void)
 {
   unsigned *p;
   unsigned v;

   def = &abc;

   def->x = &g;
   myptr = def->x;

   printf(" g = %p, %p, %d\n\n",  &g, (char * _Seg16)&g, g);

   v = (unsigned)((char * _Seg16)&g);
   printf("The following two pointers should contain the thunked\n");
   printf("address of 'g' which is  %04x:%04x\n\n", v >>
16, v & 0xfff);

   p = (unsigned *)&myptr;
   v = *p;
   printf("myptr  = %04x:%04x\n", v >> 16, v & 0xfff);

   p = (unsigned *)&def->x;
   v = *p;
   printf("def->x = %04x:%04x\n", v >> 16, v & 0xfff);

   if (myptr != def->x )
     printf("Error!!\n");

   return (0);
 }




--- Maximus/2 2.01
* Origin: Sol 3/Toronto (905)858-8488 (1:259/414)
SEEN-BY: 12/2442 620/243 624/50 632/348 640/820 690/660 711/409 410 413 430
SEEN-BY: 711/807 808 809 934 942 949 712/353 515 713/888 800/1 7877/2809
@PATH: 259/414 400 99 250/99 3615/50 229/2 12/2442 711/409 808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.