Issues with constants, and inout (was Real World usage of D, Today)
Bill Baxter
dnewsgroup at billbaxter.com
Sat Jan 27 14:32:55 PST 2007
Frits van Bommel wrote:
> So it defaults to the *smallest* character type that can hold it in one
> element.
> Pretty cool, actually.
>
> This also applies to other types, by the way. If you type an integer
> literal that won't fit into an 'int', it'll be a 'long' constant
> (assuming it fits), not an 'int' constant.
>
> Perhaps we should do something similar with string literals, defaulting
> it to use an array of the smallest character type that can hold all of
> the characters in the string (i.e. the maximum "character type" of the
> component characters) ?
And while you're at it do the same for integer and float literals -- use
the "best" type considering _all_ the elements rather than just the
first one so that this doesn't mean an array with two 1 integers.
[1, 1.5];
--bb
More information about the Digitalmars-d
mailing list