1d02fe3264e9f1d78757a31540e33c17d05691d8 galt Sat Jan 4 22:56:49 2025 -0800 added an explanatory note about using 0 not NULL to ArraySize macro. diff --git src/inc/common.h src/inc/common.h index 09764f2..48f7a85 100644 --- src/inc/common.h +++ src/inc/common.h @@ -189,31 +189,32 @@ /* _IF(0)(it was not 0, it was 0) Should be "it was 0" _IF(1)(it was 1, it was not 1) Should be "it was 1" _IF(123)(it was 123)(it was not 123) Should be "it was 123" // Could not get NULL to work as it gets replaced by ((void *)0) and then ## makes a invalid token created error. _IF(NULL)(it was not null,it was null) Should be "it was null" but does not work */ -/* How big is this array? */ +/* How big is this array? + * Parameter a must not be NULL. Use 0 instead, or just the array name. */ #define ArraySize(a) (_IF(a)((sizeof(a) / sizeof((a)[0])),(size_t)0)) #define uglyf printf /* debugging printf */ #define uglyAbort errAbort /* debugging error abort. */ #define uglyOut stdout /* debugging fprintf target. */ size_t memCheckPoint(); /* Return the amount of memory allocated since last called. */ void *needMem(size_t size); /* Need mem calls abort if the memory allocation fails. The memory * is initialized to zero. */ void *needLargeMem(size_t size); /* This calls abort if the memory allocation fails. The memory is