float.sizeof should be 4

Steven Schveighoffer schveiguy at gmail.com
Sun Sep 22 12:59:04 UTC 2024


Not `4LU`.

For the billionth time while porting raylib to D, I'm having to 
replace `n*float.sizeof` with `n*int(float.sizeof)` because 
otherwise, it doesn't fit into the `int` I'm assigning it to.

Why isn't it just 4? 4 will convert to any width you want. It 
does not poison integer multiplications or additions.

The chances that `T.sizeof > int.max` is near zero. And even if 
it did, making it the same as a number literal would just work -- 
it would become `size_t` if it was too big.

-Steve


More information about the Digitalmars-d mailing list