Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

useless class storage specifier in empty declaration

Tags:

c

enums

gcc 4.4.1 c89

I have the following code:

static enum states {     ACTIVE,     RUNNING,     STOPPED,     IDLE }; 

And I get a warning:

useless class storage specifier in empty declaration 

However, if i remove the static keyword I don't get that warning.

I am compiling with the following flags:

-Wall -Wextra 

Many thanks for any suggestions,

like image 260
ant2009 Avatar asked Apr 30 '10 10:04

ant2009


1 Answers

You get the message because you're not actually declaring, you're only defining something, namely an enumeration named "states". You can later use this definition to declare a variable of that type. That variable may be a static or instance variable, but the definition doesn't need (and shouldn't have) the storage specifier attached to it.

like image 188
tvanfosson Avatar answered Oct 18 '22 06:10

tvanfosson