Sujet : Re: Suggested method for returning a string from a C program?
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 20. Mar 2025, 20:10:22
Autres entêtes
Organisation : None to speak of
Message-ID : <874izntt5t.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6 7 8 9 10 11
User-Agent : Gnus/5.13 (Gnus v5.13)
bart <
bc@freeuk.com> writes:
[...]
This is why it popular to just do:
>
typedef long long int i64;
>
and to use %lld to print, and -LL on literals to force a 64-bit type.
Is it? I don't recall seeing anyone other than you do that.
stdint.h et al are just ungainly bolt-ons, not fully supported by the
language.
No, they're fully supported by the language. They've been in the ISO
standard since 1999.
The problem with 'long' manifests itself there too, since on Linux,
'int64_t' appears to be commonly defined on top of 'long' for 32-bit
systems, and 'long long' for 64-bit ones.
If you're writing code for which that's a problem, you probably need to
fix your code.
So somebody eschewing those ugly macros and using "%ld" to print an
'int64_t' type, will find it doesn't work when run on a 64-bit system,
where "%lld" is needed. Same problem with using '1L' to define an
int64_t literal.
Somebody writing blatantly non-portable code will run into problems when
they try to port it.
I understand that you dislike <stdint.h>. That's both perfectly
acceptable and not very interesting.
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */