dchar literals?
Jonathan M Davis
jmdavisProg at gmx.com
Tue Nov 12 00:56:05 PST 2013
On Tuesday, November 12, 2013 09:14:54 Kenji Hara wrote:
> On Monday, 11 November 2013 at 13:20:04 UTC, bearophile wrote:
> > Philippe Sigaud:
> >> And I agree with you than character literals should default to
> >> dchar. It's
> >> a perpetual source of friction for me.
> >
> > 99% of my char literals need to be of type char.
> >
> > On the other hand once you have suffixes to specify the char
> > type, most of that problem vanishes, because writing 'x'c or
> > 'x'w, 'x'd is good.
> >
> > Bye,
> > bearophile
>
> Or, uniform construction for built-in types would be another
> better way.
>
> auto c = char('a');
> auto w = wchar('a');
> auto d = dchar('a');
>
> auto x = char('à'); // compile-time error
That's more verbose, but it's something that I think we need anyway, and it
might be enough to make it not worth adding the suffixes to character literals.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list