This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

#define and struct name


Hi, when I use gcc version 2.95.3-5 (cygwin special) to compile the
following code, it gives the two warnings below.  Meanwhile, Visual C++
compiles the same code without any warnings.  Is gcc or VC++ wrong here?
The preprocessed source outputs from gcc and VC++ are the same (when I
compile the code with -E), so I guess gcc and VC++ are treating the same
code differently.

Thanks
Cheuk Cheng

pk.cpp:11: declaration of `struct thread * {anonymous struct}::thread'
pk.cpp:4: changes meaning of `thread' from `typedef struct thread_r
thread'

----------

typedef struct thread_r
{
  int	num;
} thread;

#define Pk_Thread     thread

typedef struct
{
	int		size;
	Pk_Thread	*thread;
} FailData;

int main(int argc, char **argv)
{
  FailData mydata;

  mydata.size = sizeof(mydata);
  return 0;
}


- - - - - - - Appended by PowerTV, Inc. - - - - - - - 
This e-mail and any attachments may contain information that is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]