Tuesday, April 24, 2012

Reserved keyword 'small' in Visual Studio SDK

That was a big problem to me to find out what build errors want to say. Simply, they say nothing, but only that the function is re-defined. Going deeper into code I found that error disappeared if I removed local variable 'small'. WTF?

The answer is here:

Visual Studio SDK redefines keyword 'small' as macro, see C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\RpcNdr.h (149-155).


Do not believe? Look at the code snippet (RpcNdr.h lines 149-155):


/**************************************************
 *  Other MIDL base types / predefined types:
 **************************************************/

#define small char
typedef unsigned char byte;
typedef byte cs_byte;
typedef unsigned char boolean;