Lets learn c

>lets learn c
>why enum is not working?i thought enums are supported in c
>lets look up what i fucked up

OH OF FUCKING COURSE ITS FUCKING WINDOWS GOING AGAINST EVERY STANDARD MANKIND HAS EVER CREATED JUST BECAUSE THEY WANT TO BE SPECIAL SNOWFLAKES!

What?

had to set a fucking compiler flag for enum to work :^)

>codeblocks

>had to set a fucking compiler flag for enum to work :^)
why not just use unix u silly bitch

b-but muh games!!

>OH OF FUCKING COURSE ITS FUCKING WINDOWS GOING AGAINST EVERY STANDARD MANKIND HAS EVER CREATED
And you're only realizing that now? Wasn't IE6 a good enough example for you?

This isn't a Windows problem. This is a MinGW is fucking dogshit that was literally abandoned years ago problem. Why not use MinGW-w64 or Clang?

Honestly enums in C can turn into super mess thanks to no namespaces whatsoever.

All good languages has something like

EnumForNetworkType.weWillUseIPv4Value
And compiler secures that you wont musmatch various types with each other. So in case of larger project it wont turn into huge guessing game about what various enum names means.

In C, it is just a number. And it is super prone to errors.

>EnumForNetworkTypeWeWillUseIPv4Value
This should work

This is why you typedef and prefix enums in any good code base.

Honestly C is great for certain things. I still remember how much i struggled in uni after first 2 semesters in java heaven, then said fuck it, installed mint and learned how to do debugging and valgrind properly.

I learned a lot thanks to struggling with C, and people who do whole life just java or python knows practically shit about how pc operates, but it is super archaic language.

Typedef and prefixes are just lame tries to not go crazy. Cpp is much better if you dont go crazy and use it as C with classes and few other perks.

But then you get "expert" to your team, he makes custom operands and quality and readibility of code goes to shit anyway.

But since then i went to C#, i havent look back. Try to build long complicated SQL querry in C and tell me later how it did go.

Enum is just tip of iceberg.
:-D

>Windows
Found your problem

thanks for sharing your experience, Raj

>MinGW-w64
This
Clang never works for me on winshit though

what IDE are you using for C

nice digits

needs more toolbar

>Typedef and prefixes are just lame tries to not go crazy.
/thread
It werks but it will definitely turn into at some point, like eg gtk_widget_class_set_template_from_resource demonstrates.

VStudio does not have this problem. Although it's an M$ thing your problem.

dear retard,

I assume you don't realize how to use enums or structs or unions in C.

Declaring an enum:
enum X { a, b, c };

Declaring an instance of the enum:
enum X x = a;

Yes, you have to say "enum X". The same thing happens with structs and unions. That's why you usually see it associated with a typedef:

typedef X enum { a, b, c } X;

In which case you can create an instance of an enum as follows:

X x = a;

Although I don't know if that really answers your question, I hope it was insightful!

woops, made a typo. The third code example should be "typedef enum X { a, b, c } X;"

You are suppose to use typedef to declare enums in C99.

typedef enum Retards { OP, OP_MUM, OP_DAD };

Then you declare and use as:
Retards most_retarded = OP;