Follow-up Comment #2, bug #19005 (project freeciv):

fc_real_malloc will handle that, it calls sanity_check_size. Calloc only
cares about overflow. The SIZE_MAX part is redundant I think, it is equivalent
to SIZE_MAX < nmemb * size. It can be important on some strange platforms, but
on both Intel and sparc processors max adressable memory is equal to what
size_t can contain. OpenBSD supports various strange architectures. I might be
mistaken though.

#define      SIZE_MAX                UINTPTR_MAX
/usr/include/stdint.h:155: #ifdef __LP64__
/usr/include/stdint.h:156: #define      INTPTR_MIN              INT64_MIN
/usr/include/stdint.h:157: #define      INTPTR_MAX              INT64_MAX
/usr/include/stdint.h:158: #define      UINTPTR_MAX             UINT64_MAX
/usr/include/stdint.h:159: #else
/usr/include/stdint.h:160: #define      INTPTR_MIN              INT32_MIN
/usr/include/stdint.h:161: #define      INTPTR_MAX              INT32_MAX
/usr/include/stdint.h:162: #define      UINTPTR_MAX             UINT32_MAX
/usr/include/stdint.h:163: #endif

so size_t * size_t will never be greater than SIZE_MAX on a PC.


Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to