Re: Enum? A better enum for EUPHORIA
Jeremy Cowgar wrote:
>
> 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
> <a href="http://jeremy.cowgar.com">http://jeremy.cowgar.com</a>
This would help a lot in debugging or when there is an error condition, I will
print out an error but I am not likely to write out the strings for all of say
the Windows error constants. This construct would save the programmer the
trouble
though.
Shawn Pringle
|
Not Categorized, Please Help
|
|