Liste des Groupes | Revenir à cl c |
bart <bc@freeuk.com> writes:Unix and Linux define it as 32 bits on 32-bit architectures and 64 bits on 64-bit ones.On 20/03/2025 12:09, Tim Rentsch wrote:Long is useless, because Microsoft made the mistake of definingMichael S <already5chosen@yahoo.com> writes:>>I suspected that, but was not sure, so suggested to DFS a type that I am>
sure about.
The width of char and [un]signed char must be at least 8 bits.
The width of [un]signed short must be at least 16 bits.
The width of [un]signed int must be at least 16 bits.
The width of [un]signed long must be at least 32 bits.
The width of [un]signed long long must be at least 64 bits.
>
That should be easy enough to remember now.
That table suggests that any program mixing 'short' and 'int' is
suspect. If 'int' doesn't need to store values beyond 16 bits, then why
not use 'short'?
>
'long' is another troublesome one. If the need is for 32-bit values,
then it's surprisingly rare in source code.
'long' as 32-bits on 64-bit architectures, while unix and linux
define it as 64-bits.
So long can't be used in programs intended to be portable toAs defined by Unix/Linux, long is not portable between different Unix/Linux OSes if they run on a different architecture.
other operating systems.
type in both Windows and Linux.The point was made earlier on that int64_t types are awkward to work with; they need that stdint.h header to even exist, and they need those ugly macros in inttypes.h to print out their values.
Using the defined width types is far better (e.g. uint64_t);
even if the standard allows the type to not exist on a particular
implementation. No useful implementation would fail to define
uint64_t in these modern times.
Les messages affichés proviennent d'usenet.