New enum features
Sivo Schilling
i-b-p at gmx.net
Mon Jan 7 14:53:09 PST 2008
Sean Kelly Wrote:
> Sivo Schilling wrote:
> >
> > Is there a difference between an anonymous enum member and a manifest
> > constant considering a string?
>
> I wouldn't expect so. In fact I wonder if it shouldn't be a compile
> error to pass a manifest constant string to a run-time function. How
> can you take the address of something with no storage?
>
>
> Sean
Why should it a compile time error ? From the specs I guess
that the enhanced enum feature acts as "#define" in C/C++.
And it works as shown in my simple code example.
The question is bracketing or no bracketing!
With this small modification of the original code
// enum chrm_ = "This is a manifest constant string.";
enum { chrm_ = "This is a manifest constant string."}
the result is as expected.
In this light the specs considering manifest constants
should be verified for arrays of any kind.
Sivo
More information about the Digitalmars-d
mailing list