PhobosWatch: manifest => enum
Steven Schveighoffer
schveiguy at yahoo.com
Fri Dec 28 06:55:48 PST 2007
""Jérôme M. Berger"" wrote
> Walter Bright wrote:
>> The reason this won't work is because:
>> const int x = 3;
>> will type x as const(int), not int. There needs to be a way to declare a
>> constant of type int.
>
> Er, why? Taking "&x" should return a "const (int)*" and using "x"
> directly should always work so long as you don't modify it. Are you
> telling us that the following code will fail:
>
> void func (int param)
> {
> }
>
> const int x = 42;
> int y = x; // <= This should work
> func (x); // <= This should work too
>
> Or is there something I'm missing here?
I agree with everything you are saying, except I think Walter is thinking of
the case:
const int x;
auto y = x; // y is now const
-Steve
More information about the Digitalmars-d
mailing list