Sujet : Re: Suggested method for returning a string from a C program?
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.cDate : 22. Mar 2025, 05:15:05
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250321210228.508@kylheku.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2025-03-22, bart <
bc@freeuk.com> wrote:
Since I've mostly used WinAPI via an FFI, I'm used to creating my own
bindings and using my own aliases for this ttypes. (Mostly it comes down
to one of i32 i64 u32 u64 plus a pointer type.)
When I FFI to Windows, I tend to be a stickler for using names that
are exactly the same, wherever possible. I have DWORD, HWND,
and whatnot.
You can see it in this code; it is self-contained. It defines
all the symbols it needs, and requires just the DLLs:
https://rosettacode.org/wiki/Window_creation#Win32/Win64Thus long has to be stuck on 32 bits.
>
There really isn't much in it. Here's the evolution as I see it (I stand
to be corrected if necessary):
There isn't much in it, but it doesn't take much in order to
pin things down and prevent change.
The point is that there was usually a size exactly double the width of
'int', but it become less necessary when 'int' reached 64 bits.
Yes, because other than for masks of 128 bits, there isn't a whole
lot of stuff you can *count* for which you need such large integers.
Money?
In an accounting system, if you use signed 64 bits for pennies, you can
go to 9.2 x 10^16 dollars.
Large integers are needed for crypto and such, but then 128 isn't enough
anyway.
Obviously, IPv4 addresses are 128. In protocol stacks, switching and
routing, it could be useful to have 128 bit operations on them for
masking and comparing and whatnot.
-- TXR Programming Language: http://nongnu.org/txrCygnal: Cygwin Native Application Library: http://kylheku.com/cygnalMastodon: @Kazinator@mstdn.ca