typedef
{ unsigned __int8 uint8;
unsigned __int16 uint16;
unsigned __int32 uint32;
unsigned __int8 char8;
char8 * string8;
signed __int32 BOOL;
__int32 WPARAM;
__int32 LPARAM;
__int32 HWND;
unsigned __int32 UINT;
__stdcall CALLBACK;
}
Can someone please tell me why this is wrong More specifically, the compiler seems to want a typedef statement for each typedef, and I haven't seen the rule that makes this an unacceptable shortcut.

typedef arrangement CL doesn't like
duncan_goldcoast
Enzima
__stdcall is more like a type than struct is, going where you would also put a type for functions.
Joachim Juell
I don't know what you are talking about. struct is a keyword. function is nothing.
typedef does not define keywords. It defines types. I stop now. This discussion targets nothing and helps nobody.
chuckles
Also you are completely wrong when you say typedef defines types. typedef defines new names for pre-existing types.
Did you even read entirely http://msdn.microsoft.com/library/default.asp url=/library/en-us/vccelng/htm/tions_14.asp
or did you just look at
Fotis Elianos
bt8114
typedef void DRAWF(int,int); Absolutly follow the rules! Because here a function is defined and () tights close.
steveQ56
typedef void DRAWF( int, int ); doesn't follow the rules as explained either.
Again:
typedef char CHAR, *PSTR;
Plus all the other places where brackets are allowed, suggests it would not be unlikely here. Plus, I know of no good reason why the programming language wasn't designed to alow brackets to be used like this. It would be the eqivalent of saying all these items fall within the scope of a typedef argument.
Mediocretes
Riju
http://msdn.microsoft.com/library/default.asp url=/library/en-us/vccelng/htm/tions_14.asp
The confusion was not over how many arguements struct is to typedef, but why it can be an argument to typedef at all, since it isn't a type.
Whenever brackets are used they are in place of a set of tokens followed by a simicolon, so why shoudn't one be able to replace any string of tokens followed by a simicolon with a set of brackets..
B. Ritter
I don't know where you got your typdef knowladge from, but most of what you say is wrong.
typedef sturct thisstruct{...} whatever;
This works because the compiler creates a synonym for the struct, so when you type out whatever the compiler translates it to struct thisstruct. It can be though of as being similar to #define struct thisstruct whatever
typedef struct{...} whatever;
This works because the compiler defines a unique anonymous value for the structure, it is that simple. It then follows the same procedure as stated above.
The struct is also only counted as one argument of the typdef so it still follows the syntax of one definition per typdef.
__stdcall isn't a type, in fact when the program is compiled it is lost completely. If you don't believe me on this, create an asm output file and look at the functions and the way that the functions are called. __stdcall, like __fastcall and __cdecl are the way that the functions are called, this is important because the calling conventions don't mix. So why doesn't __stdcall count as a type, because it is how the function is called, not really part of the function decleration itself. Since the typdef is there to create a fast way of defining a function then it wouldn't include the calling convention. Since one of the biggest issues is what happens if you require different calling conventions for the same function signiture. So the calling convention should be applied to the definition itself.
Also why did you bring natural languages and go off saying this is about CL, it is always about CL since that is the c/c++ compiler front end.
Teetime
The correct syntax is
typedef type-declaration synonym;
And there is no other defintion for it:
http://msdn.microsoft.com/library/default.asp url=/library/en-us/vccelng/htm/tions_14.asp
Why do you expect this to be correct
As you wrote: every typedef must be a typedef for its own.
typedef unsigned __int8 uint8;
typedef unsigned __int16 uint16;
typedef unsigned __int32 uint32;
TheSteve
icon_snowman
All types are lost when a program is compiled.
I started out programming in QuickBASIC with coding support routines in Assembly and spent quite a bit of time doing that, so much of my perspective is colored by it.
Freebasic of Freebasic.net is a modern BASIC built on the QB syntax. I bring this up because there is quite a few people slamming QB.
intech
typedef is nothing like define!