Forward declaration of enums in C does not work for me.
I searched the Internet and Stack Overflow, but all of the questions regarding forward declarations of enumerators refer to C++. What do you do for declaring enumerators in C?
Put them at the top of each file (or in a header), so that all functions in the file can access them?
Put them in a header so that all files that need them can access the header and use the declarations from it.
When compiled with the options:
GCC 4.2.1 (on Mac OS X 10.7.1 (Lion)) accepts the following code:
Add
-pedanticand it warns:Thus, you are not supposed to try using forward declarations of enumerated types in C; GCC allows it as an extension when not forced to be pedantic.