Question about iteger literals

bearophile via Digitalmars-d-learn digitalmars-d-learn at
Sun Jun 22 04:27:23 PDT 2014


> But I don't understand why in expression where both of 
> arguments have type char:
> 	return c - '0';
> I have resulting type int. It's very strange for me and looks 
> very buggy)

In D operations among chars return a int. The same happens in 

If you subtract a char from a char in general you can have a 
negative result, that can't fit in a char. So what's buggy is 
your thinking.


More information about the Digitalmars-d-learn mailing list