Liste des Groupes | Revenir à c arch |
On 9/12/2024 5:12 AM, Tim Rentsch wrote:
>BGB <cr88192@gmail.com> writes:>
>
[...]
>Would be nice, say, if there were semi-standard compiler macros for>
various things:
Endianess (macros exist, typically compiler specific);
And, apparently GCC and Clang can't agree on which strategy to use.
Whether or not the target/compiler allows misaligned memory access;
If set, one may use misaligned access.
Whether or not memory uses a single address space;
If set, all pointer comparisons are allowed.
>
[elaborations on the above]
I suppose it's natural for hardware-type folks to want features
like this to be part of standard C. In a sense what is being
asked is to make C a high-level assembly language. But that's
not what C is. Nor should it be.
There are a few ways things can go:
Define rules, have one of N permutations for how those rules can go;
How it often worked in practice.
Throw up hands and say it is unknowable.
What a lot of "portability" people assert.
Do whatever gives the fastest results in standardized benchmarks.
What many compiler maintainers want.
Les messages affichés proviennent d'usenet.