R
Rouben Rostamian
I searched the C99 standard and clc's FAQ but was unable to
find an answer to the following issue. I hope that someone
here can illuminate me.
Suppose I have:
enum myenum { enuma, enumb, enumc };
near the top of a file, outside any functions.
Now, I don't want to have external linkage for this enum, that
is, I don't want it to be visible outside its translation unit.
So I added static to the declaration, as in:
static enum myenum { enuma, enumb, enumc };
When I compile this with gcc, it emits the message:
warning: useless keyword or type name in empty declaration
Therefore gcc does not like a static enum.
So I have the following questions:
1. Is an enumeration type, as described above, amenable
to external linkage?
2. If yes, then how does one hide a file-scope enum within
its translation unit?
3. If no, where in the standard is this behavior specified?
find an answer to the following issue. I hope that someone
here can illuminate me.
Suppose I have:
enum myenum { enuma, enumb, enumc };
near the top of a file, outside any functions.
Now, I don't want to have external linkage for this enum, that
is, I don't want it to be visible outside its translation unit.
So I added static to the declaration, as in:
static enum myenum { enuma, enumb, enumc };
When I compile this with gcc, it emits the message:
warning: useless keyword or type name in empty declaration
Therefore gcc does not like a static enum.
So I have the following questions:
1. Is an enumeration type, as described above, amenable
to external linkage?
2. If yes, then how does one hide a file-scope enum within
its translation unit?
3. If no, where in the standard is this behavior specified?