DMD 1.019 and 2.003 releases
Derek Parnell
derek at nomail.afraid.org
Mon Jul 23 22:15:05 PDT 2007
On Mon, 23 Jul 2007 21:25:31 -0700, James Dennett wrote:
> BCS wrote:
>> Reply to Derek,
>>
>>> Are you serious??? Why are we allowed to do mathematics with
>>> characters?
>>>
>>
>> I have done this a few times
>>
>> char c;
>> int v = (c - '0')
>
> Perfectly reasonable, as is character +/- integer, but
> character + character is nonsense, just as it makes sense
> to subtract two points yielding a vector, or add a vector
> to a point (yielding a point) but no sense to "add" two
> points in a mere affine space.
I'm sorry. I am a bit of a pedantic bastard at times.
I use ...
char c;
int v = (cast(int)c - '0')
To me it the same as assuming that boolean values are integers.
--
Derek
(skype: derek.j.parnell)
Melbourne, Australia
24/07/2007 3:13:04 PM
More information about the Digitalmars-d-announce
mailing list