2021.01.16 14:56 "Re: [Tiff] MergeRequest for discussion code style", by Bob Friesenhahn
- Using `long` is WRONG (rhyme intended). If you're in the Unix world, that's fine but as soon as you go to Windows (and possibly on other OSes), sizeof(long) == sizeof(int) == 4 regardless of whether you're compiling as a 32-bit or 64-bit process. If the intention here is to use a signed integer type that is 32-bit on 32-bit processes and 64-bit on 64-bit processes, then the right type might be `intptr_t` for C99. (Although I personally like the POSIX idea of `ssize_t` better but I forget whether that's available on Windows).
If there is still some interest in portability, then ptrdiff_t is a more portable choice than intptr_t and it should be as available as size_t. The definition of ptrdiff_t is much older than the definition of intptr_t, including Microsoft compilers.
Take care about the POSIX idea of ssize_t because of what it is defined to be. The POSIX definition of ssize_t is that it is the type returned by the read() function. Under 64-bit Windows, this type remains just an 'int' (as returned by _read()) and so it is not actually a signed equivalent of size_t.
It is indeed useful to know the maximum amount of data that read() can return since if one requests more than the maximum allowed value, error checking becomes impossible.
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
Public Key, http://www.simplesystems.org/users/bfriesen/public-key.txt