just an example:
the previous use of enum with assignment is ANSI C or it is something working only for some C compilers?Code:typedef enum { TimeOut = 0x0938, CC = 0x0A00 } Type_RegisterAddress;
just an example:
the previous use of enum with assignment is ANSI C or it is something working only for some C compilers?Code:typedef enum { TimeOut = 0x0938, CC = 0x0A00 } Type_RegisterAddress;
It's valid in C99; I don't remember whether it was valid in C89.
Yes you can do that.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Yes, that is ANSI standard C89.
http://www.infoanarchy.org/en/C89An enumeration type declares a set of named constants, with type int. An enumerator with = defines enumeration constant. If the first enumerator has no =, its enumeration constant is 0. Each enumerator with no = defines an enumeration constant, by adding 1 to the previous one.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.