lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Tom N Harris wrote:
> When building with LUA_USE_APICHECK defined, I get
> 
>      gcc -g -O2 -Wall -DLUA_COMPAT_ALL -D__NO_STRING_INLINES 
> -DLUA_USE_APICHECK -DLUA_USE_LINUX   -c -o lapi.o lapi.c
>      lapi.c: In function ‘lua_arith’:
>      lapi.c:289: error: ‘else’ without a previous ‘if’
>      make: *** [lapi.o] Error 1
> 
> Had to scratch my head at that until I remembered that "api_check(...);" 
> is a macro that expands to "{ ... };" so line 288 needs to be in braces.

Actually, all those "#define foo {...}" should be "#define foo do {...} while (0)".

   http://c-faq.com/cpp/multistmt.html

Ciao, ET.