Conditional Templates

Jarrett Billingsley kb3ctd2 at yahoo.com
Mon Jan 29 20:53:10 PST 2007


"Derek Parnell" <derek at nomail.afraid.org> wrote in message 
news:2bjnrvcmm8o9$.k39bxr2x2c52$.dlg at 40tude.net...

> So it seems that D regards characters and
> integers as interchangeable entities, which is just not correct. I know
> that characters are implemented in memory as integers, but they are
> conceptually different things, and just sometimes coders need to treat 
> them
> as different things.

I hate this too.  I've ended up writing all kinds of ugly templates to deal 
with this problem.  I also really like this one:

static assert(is(bool : dchar));

This passes.  This caused a very difficult-to-find bug in MiniD, because 
never in a million years would I have expected bool to be implicitly 
convertible to dchar. 




More information about the Digitalmars-d-learn mailing list