Re: Using a char value >= 128

2019-10-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, October 27, 2019 6:44:05 AM MDT Per Nordlöw via Digitalmars-d- learn wrote: > In which circumstances can a `char` be initialized a non-7-bit > value (>= 128)? Is it possible only in non-@safe code? > > And, if so, what will be the result of casting such a value to > `dchar`? Will that

Re: Using a char value >= 128

2019-10-27 Thread Ernesto Castellotti via Digitalmars-d-learn
On Sunday, 27 October 2019 at 14:36:54 UTC, Ernesto Castellotti wrote: On Sunday, 27 October 2019 at 12:44:05 UTC, Per Nordlöw wrote: [...] char in D is always unsigned, it is not implementation-specific. Therefore it can take values ​​up to (2^8)−1, If you want a signed 8 byte type you can

Re: Using a char value >= 128

2019-10-27 Thread Ernesto Castellotti via Digitalmars-d-learn
On Sunday, 27 October 2019 at 12:44:05 UTC, Per Nordlöw wrote: In which circumstances can a `char` be initialized a non-7-bit value (>= 128)? Is it possible only in non-@safe code? And, if so, what will be the result of casting such a value to `dchar`? Will that result in an exception or will

Re: Using a char value >= 128

2019-10-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 27 October 2019 at 12:44:05 UTC, Per Nordlöw wrote: In which circumstances can a `char` be initialized a non-7-bit value (>= 128)? Is it possible only in non-@safe code? All circumstances, `char`'s default initializer is 255. char a; // is 255 And, if so, what will be the result

Using a char value >= 128

2019-10-27 Thread Per Nordlöw via Digitalmars-d-learn
In which circumstances can a `char` be initialized a non-7-bit value (>= 128)? Is it possible only in non-@safe code? And, if so, what will be the result of casting such a value to `dchar`? Will that result in an exception or will it interpret the `char` using a 8-bit character encoding?