4 ms·
> Wheras, the direct equivalent in C, an assignment with a (type changing) cast, is illegal. I don't understand what you mean by that. The direct equivalent of
by simias 5y ago
> Wheras, the direct equivalent in C, an assignment with a (type changing) cast, is illegal.
I don't understand what you mean by that. The direct equivalent of what?
Endianess is not part of the type system in C so I'm not sure I follow.
> I think there should really be a dialect of C(++) where the machine model is exactly the physical machine.
Linus agrees with you here, and I disagree with both of you. Some UBs could
certainly be relaxed, but as a rule I want my code to be portable and for the
compiler to have enough leeway to correctly optimize my code for different
targets without having to tweak my code.
I want strict aliasing and I want the compiler to delete extraneous NULL pointer
checks. Strict overflow I'm willing to concede, at the very least the standard
should mandate wrap-on-overflow ever for signed integers IMO.
- lanstin 5y agoI am sympathetic, but portability was more important in the past and gets less important each year. I used to write code strictly keeping the difference between numeric types and sequences of bytes in mind, hoping to one day run on an Alpha or a Tandem or something, but it has been a long time since I have written code that runs on non-(Intel AMD or le ARM)
- alexvoda 5y agox86_32, x86_64, arm, arm64, POWER , RISC-V and several others are alive and kicking. China is making their own ISA. And there is still plenty of space and time for new ISAs to be created. Portability is still plenty relevant.