Doubt about char.min/max == typeid(char)

matheus matheus at gmail.com
Fri Oct 7 04:40:26 UTC 2022


On Friday, 7 October 2022 at 01:02:57 UTC, torhu wrote:
> On Friday, 7 October 2022 at 00:13:59 UTC, matheus wrote:
>> Hi,
>>
>> Could anyone please tell me why the properties of min/max of a 
>> char returns a "char type" and not a value as an int?
>
> Well, why whould the highest and lowest values of a type be of 
> a different type..?

Hmm well I was thinking the min/max as a range/limits, in this 
case 0 to 255 or it could be -128 to 127 if signed, or in a case 
of a bool: 0 to 1, but now I see it returns the min/max value of 
the type itself, like the latter false/true.

I had my reasoning based on my experience with C.

Thanks,

Matheus.



More information about the Digitalmars-d-learn mailing list