Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4268214
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:00:20+00:00 2026-05-21T07:00:20+00:00

In a discussion, a colleague told me that he never uses enum because he

  • 0

In a discussion, a colleague told me that he never uses enum because he experienced that some C-compilers don’t cope with the enum statement correctly.

He couldn’t remember which compiler exactly had problems but among the problems, there were errors when doing something like

enum my_enum{
  my_enum_first  = 5;
  my_enum_second = 10;
};

i.e. initializing enum values instead of letting the compiler do the automatic assignment. Another one was that the compiler decides for itself how big the enum is and therefore you could have unpredictable behavior for sizeof my_enum when compiling your code under various platforms.

To get around that, he told me to better use #defines to define the constant elements. But especially for using doxygen it’s quite handy to have an enum (e.g. as function parameter) because in the generated documentation, you could simply click on my_enum and directly jump to the description of my_enum.

Another example would be code completion, where your IDE tells you what you could specify as valid parameters for functions. I know that – as long as you’re compiling the code as C-code – that there’s no type-safety (i.e. I could also specify 5 instead of my_enum_first), so the use of an enum seems to be a more cosmetic thing.

The question is: do you know any compilers that have limitations regarding the usage of enum?


Edit 1:
Regarding the environment: we are developing for various embedded platforms, so there could also be a compiler for some obscure micro-controller…


Edit 2:
He could tell me that the KEIL C51 compiler didn’t play well with enums. Are there any experiences with current versions of the C51 compiler?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T07:00:21+00:00Added an answer on May 21, 2026 at 7:00 am

    I’m pretty sure that a compiler that doesn’t play nice with enum is an invalid compiler – enum is specified in the standard, so a failure to implement it means the compiler shouldn’t technically be used to compile C (For the record, the scope of enumeration types is discussed in 6.2.1 and defined as a type in 6.2.5 (of C99), so one would assume that it’s a valid part of the standard from thereon in)!
    So no, I don’t know of any such compilers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had a discussion with some colleagues mentioning that there are not too many
I'm haiving an interesting discussion with an esteemed colleague and would like some additional
Today I had a discussion with a colleague about nested functions in Javascript: function
I had a discussion with a colleague at work, it was about SQL queries
I recently had a discussion with a colleague about serialization of byte data over
I had a heated discussion with a colleague on the usage of stored procedures
I've had a discussion with a colleague about Linq to SQL. I am still
I am in the middle of a discussion with a colleague about the best
A while ago, I had a discussion with a colleague about how to insert
A discussion amongst some colleagues emerged recently how in today's software industry, two separate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.