Liste des Groupes | Revenir à cl c |
Richard Kettlewell <invalid@invalid.invalid> writes:There’s more to life than byte arrays, though, so I wonder if there’s>
more to be said here. I find myself dealing a lot with large integers
generally represented as arrays of some unsigned type (commonly uint32_t
but other possibilities arise too).
>
In C as it stands today this requires a translation step before
constants can be embedded in source code (which is error-prone if
someone attempts to do it manually).
>
So being able to say ‘0x8732456872648956348596893765836543 as array of
uint64_t, LSW first’ (in some suitably C-like syntax) would be a big
improvement from my perspective, primarily as an accelerator to
development but also as a small improvement in robustness.
You could use some kind of type punning. For example, this is currently
legal:
>
union {
unsigned char buf[4];
uint32_t n;
} obj = {
.buf = { 0x01, 0x02, 0x03, 0x04 }
};
The { 0x01, 0x02, 0x03, 0x04 } could be replaced with 0x"01020304".
>
Of course you have to deal with endianness.
Les messages affichés proviennent d'usenet.