Liste des Groupes | Revenir à cl c |
bart <bc@freeuk.com> wrote:
Which was not its intention. (Probably intptr_t or ssize_t is better for that purpose, and will be portable between Windows and Linux.)As defined by Unix/Linux, long is not portable between differentIt portably between 32 and 64 bit machines gives word-sized
Unix/Linux OSes if they run on a different architecture.
integer type.
I explained the differences without necessarily saying one is better than the other. Sometimes one is more more useful, sometimes the other.As defined by Microsoft, long is portable between Windows OSes even onIt gives 'long' different meaning than it had previously.
different architectures.
And toWell, 'long' is also useless on 32-bit Linux machines as it is the same size as 'int'. Why didn't it also increase when 'int' migrated from i16 to i32?
that matters rather useless meaning, as already 'int' gives 32
bit integers on bigger machines.
Sorry, yes. But it shows how confusing it all is:'long long' is defined as a 64-bit<snip>type in both Windows and Linux.>
>
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.The problem with 'long' manifests itself there too, since on Linux,You mixed up this: 'int64_t' is defined as 'long long' for 32-bit
'int64_t' appears to be commonly defined on top of 'long' for 32-bit
systems, and 'long long' for 64-bit ones.
systems and as 'long' for 64-bit ones.
Doing it as you wrote(I'll tell you a secret: my C compiler automatically reads a special header that includes these definitions:
would give you variable length type. Of course, if you need
word-sized integer in Windows you may define it as 'long' for 32-bit
Windows and as 'long long' for 64-bit ones.
Les messages affichés proviennent d'usenet.