enum scope

Mike Parker aldacron at gmail.com
Thu Jan 26 05:42:47 PST 2012


On 1/26/2012 10:23 PM, Trass3r wrote:
>> It's not type safe in C. But you can wrap it in a struct with alias
>> this instead.
>
> Yep, but in D we have strong enums, so why not use them.

If your binding is for yourself, that's not a big deal. But if you're 
putting it out there for public consumption, then I think compatibility 
with the C version would be more important. If someone is looking at 
sample C code, you should make it they don't need to adjust it much at 
all. In some cases, this is unavoidable (bit fields, macros), but where 
it *is* avoidable, it should be.


More information about the Digitalmars-d mailing list