Getting action on your favorite D issues

Steven Schveighoffer schveiguy at gmail.com
Sat Jun 6 16:48:56 UTC 2020


On 6/6/20 9:31 AM, Meta wrote:
> On Saturday, 6 June 2020 at 03:56:43 UTC, Timon Gehr wrote:
>> On 06.06.20 05:40, Meta wrote:
>>>
>>> The linked defect, and the issue you posted, don't really make sense 
>>> to me. They both have UB; reading from an uninitialized variable (= 
>>> void), or writing to one member of a union and reading from the 
>>> other. Invoke Undefined Behaviour and you get... Undefined Behaviour.
>>
>> Right. It's in @safe code.
> 
> Ah, yes, I missed that. Why the hell is = void allowed in @safe again? I 
> vaguely remember Walter arguing that it should be for some reason.

int x = void;

Does not and cannot corrupt memory (assuming everything that uses it is 
@safe).

The larger issue here is that bool is really an integer type from 0 to 
1, but is implemented as an 8-bit value. In that case, the assumptions 
made by the compiler are not always correct.

There was a DIP to make bool actually not an integer, and it was rejected.

-Steve


More information about the Digitalmars-d mailing list