Re: enum options

new topic     » goto parent     » topic index » view thread      » older message » newer message
Bernie said...

enum should be perform in the same way that it is used in C.

Why don't you go to a C compiler source code and see how it is done in that code.

The last thing I want to do is to go through the source code for a C-compiler. I'm not sure what purpose this would serve, in any case.

Bernie said...

If it was done this way then translating to compiled C code would be straight forward...

I can't imagine how it would make anything easier when translating to C code.

Bernie said...

...and new users who use C would not be confused.

This suggestion assumes that the most common usage of enums will be for wrapping C code. I doubt this to be the case. And I care more for making euphoria easier for euphoria programmers than for theoretical users coming from another language. They know that they're using a different language. Since we're actually programming in euphoria, we should follow euphoria conventions, and starting at 1 is much more useful. It's really not that difficult to add in the "= 0" to the first enum, if that's the requirement.

Further, I think that the "with base=n" will lead to difficult to maintain code. I think that if you need some weirdness, it's better to explicitly declare it. If you're creating a set of bit flags, don't use enums. Use constants. It will be much clearer for everyone reading the code.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu