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

2022-10-07 Thread ag0aep6g via Digitalmars-d-learn
On 07.10.22 07:06, bauss wrote: If you don't need to assign it then you can cast it. ``` void a(int x) { ... } a(cast(int)char.max); ``` Even though in the example above the cast isn't necessary, if you want to be sure a(int) is called then you must cast it, since an overload of char will

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

2022-10-06 Thread bauss via Digitalmars-d-learn
On Friday, 7 October 2022 at 04:40:26 UTC, matheus wrote: 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 char casts implicitly to int, so if you really need it as an integer type just type your variable as such. ```d int a

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

2022-10-06 Thread matheus via Digitalmars-d-learn
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

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

2022-10-06 Thread torhu via Digitalmars-d-learn
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..? ```d import std; void

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

2022-10-06 Thread matheus via Digitalmars-d-learn
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? I just got this while playing around: void main(){ import std.stdio; writeln(char.max); // "nothing" writeln(typeid(char.max)); // "char"