Liste des Groupes | Revenir à cl c |
On 21/03/2025 17:51, Waldek Hebisch wrote:bart <bc@freeuk.com> wrote:As defined by Unix/Linux, long is not portable between different
Unix/Linux OSes if they run on a different architecture.
It portably between 32 and 64 bit machines gives word-sized
integer type.
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 Microsoft, long is portable between Windows OSes even on
different architectures.
It gives 'long' different meaning than it had previously.
I explained the differences without necessarily saying one is better
than the other. Sometimes one is more more useful, sometimes the other.
And to
that matters rather useless meaning, as already 'int' gives 32
bit integers on bigger machines.
Well, 'long' is also useless on 32-bit Linux machines as it is the same
size as 'int'.
One 'con' for Linux' approach is when someone assumes 'long' is i32;
when they run code on 64 bits, it will either be wasteful, or it could
go badly wrong.
(I'm so glad I switched to all-64-bits in my own stuff, early last decade.
However lots of software has taken a long time to catch up. I acquired
an RPi 4 board 5 years ago with a view to doing 64-bit ARM development,
but most OSes were still 32 bits, and 64-bit ones immature. (You need a
64-bit OS to easily develop and run 64-bit programs.)
Even now, 32-bit OSes are supplied by default. I finally got a solid
64-bit OS for it last week. I just wondered what the point is of having
64-bit hardware if people just run 32-bit stuff on it.)
Les messages affichés proviennent d'usenet.