[A89] Re: TI-GCC enum question
[Prev][Next][Index][Thread]
[A89] Re: TI-GCC enum question
Hi!
> You may ignore this plea for help. TI-GCC seems to be more
> different than standard C than I expected...
TI-GCC is fully standard, but you obviously don't know what
is C and what is C++. Your constructions are from C++!
> enum Bool ToF=0; //set ToF to be of type Bool (gray.h) and initialize
to 0
Yes, C needs 'enum' before enumerated types. A workarround is
typedef enum Bool bool;
Then you can use
bool ToF=0;
> int x=0; //set x to be of type int and initialize to 0
> for(;x<9;ToF=x++) //why can't x be set and initialized in the for loop?
Because in ordinary C you can't declare variables in the loop. But
you can do
int x;
for(x=0;x<9;ToF=x++);
Also, all declarations in C must be defined prior to first executive
statement.
> You have to use 'enum' to define a variable with an enum type:
> enum Bool ToF=0;
Yes, in _all_ C dialects.
> instead of standard C:
> Bool ToF=0;
This is from C++. Again, TI-GCC is _standard_ C with a lot of extension
but it supports everything from _standard_ C!!!
Cheers,
Zeljko Juric
Follow-Ups: