[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

>lets learn c >why enum is not working?i thought enums

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 23
Thread images: 4

File: Screenshot (94).png (170KB, 1366x768px) Image search: [Google]
Screenshot (94).png
170KB, 1366x768px
>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!
>>
>>60866324
What?
>>
File: Screenshot (95).png (133KB, 1366x768px) Image search: [Google]
Screenshot (95).png
133KB, 1366x768px
had to set a fucking compiler flag for enum to work :^)
>>
File: 1339650964940.jpg (9KB, 251x251px) Image search: [Google]
1339650964940.jpg
9KB, 251x251px
>codeblocks
>>
>>60866357
>had to set a fucking compiler flag for enum to work :^)
why not just use unix u silly bitch
>>
>>60866447
b-but muh games!!
>>
>>60866324
>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?
>>
>>60866324
>>60866357
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?
>>
>>60866324
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.
>>
>>60866644
>EnumForNetworkTypeWeWillUseIPv4Value
This should work
>>
>>60866644

This is why you typedef and prefix enums in any good code base.
>>
>>60866832
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
>>
>>60866324
>Windows
Found your problem
>>
>>60866920
thanks for sharing your experience, Raj
>>
>>60866562
>MinGW-w64
This
Clang never works for me on winshit though
>>
what IDE are you using for C
>>
>>60868888
nice digits
>>
File: 1497256282378.png (224KB, 1366x768px) Image search: [Google]
1497256282378.png
224KB, 1366x768px
>>60866357
needs more toolbar
>>
>>60866920
>Typedef and prefixes are just lame tries to not go crazy.
/thread
It werks but it will definitely turn into >>60866741 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!
>>
>>60871509
woops, made a typo. The third code example should be "typedef enum X { a, b, c } X;"
>>
>>60866357
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;
Thread posts: 23
Thread images: 4


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.