delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/07/30/01:34:21

From: ismaelj AT hotmail DOT com ("Ismael Jurado")
Subject: (none)
30 Jul 1997 01:34:21 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199707291933.MAA22419.cygnus.gnu-win32@f30.hotmail.com>
X-Originating-IP: [194.224.19.84]
Original-To: jeffdb AT netzone DOT com
Original-Cc: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

I've been doing the job of porting the examples of Petzold's book 
"Programing
Windows 95" (now I'm busy with other work, soon I'll post the results) 
and I'd
found the same problem with unamed unions under gcc. As I see in your 
diff
file you just make this change to the headers:

from MS:
        typedef struct tagFoo {
           int x;
           union {
              int a;
              char b;
           };
           double x;
        } Foo;

from you:
        typedef struct tagFoo {
           int x;
           union {
              int a;
              char b;
           } u1;         <----- you give a name
           double x;
        } Foo;

and then use that name to acces the members in the program code:

from MS:
	... //other code
	Foo foo;
	foo.a=25;
	... //more code

from you:
	... //other code
	Foo foo;
	foo.u1.a=25;
	    ^^ dummy union name
	... //more code

But once you give a name to the nested union in the .h file, you can 
acces any data menber as the original MS code, you don't have to include 
the 
"u1"!, at least in beta 17.1. I hope this will make a smaller diff file.

Ismael Jurado
ismaelj AT hotmail DOT com



______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019