Re: Enum? A better enum for EUPHORIA
Shawn Pringle wrote:
>
> Instead of enum as it is from C. We can vastly improve on
> enum. Consider labeling a group of constants in an enum statement
>
> enum memory_protection MEM_WRITEREAD = #40, MEM_READ = #80, ...
>
>
> puts(1, memory_protection.to_string( #40 )) -- displays "MEM_WRITEREAD"
>
>
> enum bitfield linux_memory_protection PROT_NONE = 0,
> PROT_READ = 1,
> PROT_WRITE = 2, PROT_EXEC = 4
>
> puts( 1, linux_memory_protection.to_string( 3 ) ) -- displays "or_bits(
> PROT_READ,
> PROT_WRITE )"
Do you want var names stored in translated and IL code? How would that be
helpful? Also, it seems that the enum would create a namespace that would then
have to be tracked, parsed and looked up? I'm a bit confused at what this
accomplishes, can you expand a bit. I am all for better things.
--
Jeremy Cowgar
http://jeremy.cowgar.com
|
Not Categorized, Please Help
|
|