inline functions
-----------------------
#ifdef _MSC_VER
#define INLINE __forceinline
/* use __forceinline (VC++ specific) */
#elif defined(__GNUC__)
#define INLINE inline __attribute__((always_inline))
/* use __attribute__((always_inline)) (GCC 4.3 latr) */
#else
#define INLINE inline
/*use standard inline*/
#endif
---------------------------------------
local variable declaration
---------------------------------------
---------------------------------------
/*GCC allows intermediately declaration*/
int function()
{
int a = 3, b= 5, c;
b++;
a++;
c = a * b;
char buffer = (char)c + a + b;
//error C2143: syntax error : missing ';' before 'type'
return buffer;
//error C2065: 'buffer' : undeclared identifier
}
/*In VC2010, all declaration must be put at the start of the function*/
int function()
{
int a = 3, b= 5, c;
char buffer;
b++;
a++;
c = a * b;
buffer = (char)c + a + b;
return buffer;
}
No comments:
Post a Comment