I am a c# programmer, hobbyist actually, with deep interest in programs both low-level and high-level. Many a time I come across C/C++ projects that have huge amounts of code like this ->
#if defined(LUA_COMPAT_GETN)
LUALIB_API int (luaL_getn) (lua_State *L, int t);
LUALIB_API void (luaL_setn) (lua_State *L, int t, int n);
#else
#define luaL_getn(L,i) ((int)lua_objlen(L, i))
#define luaL_setn(L,i,j) ((void)0) /* no op! */
#endif
#if defined(LUA_COMPAT_OPENLIB)
#define luaI_openlib luaL_openlib
#endif
/* extra error code for `luaL_load' */
#define LUA_ERRFILE (LUA_ERRERR+1)
I find it difficult to wrap my head around all this, I can understand and program c# well. I can program in C/C++ but I dont understand the need for such declarations and syntax. Am I missing something? Is there a book or website that I can learn the use and need for such statements?
Note : I am an electrical engineer, so have limited exposure to programming in college. Most of what I can do is self-learnt.