|
|
|
|
|
by ozgrakkurt
2 hours ago
|
|
> Consider, for instance, bitcasting a [2]u8 to a u16. Under the old semantics, the result of this operation depends on the target endian: on big-endian targets, the first array element became the 8 most significant bits, whereas on little-endian targets, the first array element became the 8 least significant bits. Under the new semantics, because we only care about logical bit representation (which is endian-agnostic), the operation behaves identically on every target: This is a huge mistake. You would never expect something like bitCast to do this. I don't understand this approach. Why change something so simple and low level to be complicated and high level? Just don't allow casting to u24, as it makes no sense unless you define u24 to be u32 sized as I think c standard does. I think this approach as an idea is bad but at least just add another built-in that implements this higher level idea to not break a simple expectation and current behavior? |
|