View Single Post
Old September 22, 2009, 18:48   #4
Sirridan
Knight
 
Sirridan's Avatar
 
Join Date: May 2009
Posts: 560
Sirridan is on a distinguished road
Actually, I ran this code segment on the same basic array, and N_ELEMENTS was returning 12 for resists as it should...

Code:
#include <stdio.h>

#define N_ELEMENTS(a) (sizeof(a) / sizeof((a)[0]))

#define	        TR1_RES_POIS	0x1
#define	        TR1_RES_FEAR	0x2
#define	        TR1_RES_LITE	0x4
#define	        TR1_RES_DARK	0x8
#define	        TR1_RES_BLIND	0x10
#define	        TR1_RES_CONFU	0x20
#define	        TR1_RES_SOUND	0x40
#define	        TR1_RES_SHARD	0x80
#define	        TR1_RES_NEXUS	0x100
#define	        TR1_RES_NETHR	0x200
#define	        TR1_RES_CHAOS	0x400
#define	        TR1_RES_DISEN	0x800


void main()
{
	static const unsigned int ego_resists[] =
	{
	        TR1_RES_POIS,
	        TR1_RES_FEAR,
	        TR1_RES_LITE,
	        TR1_RES_DARK,
	        TR1_RES_BLIND,
	        TR1_RES_CONFU,
	        TR1_RES_SOUND,
	        TR1_RES_SHARD,
	        TR1_RES_NEXUS,
	        TR1_RES_NETHR,
	        TR1_RES_CHAOS,
	        TR1_RES_DISEN,
	};
	printf("%d\n",N_ELEMENTS(ego_resists));
	printf("done\n");
}
Any thoughts?
Sirridan is offline   Reply With Quote