lua-users home
lua-l archive

Re: Syntax and redundancy

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


Boyko Bantchev wrote:
On 8/30/05, Rici Lake <lua@ricilake.net> wrote:
Try:
DO(i, 0, 9,
 int j, k;
 j = 2 * i;
 k = i + 1;
 printf("i = %d, j = %d, k = %d\n", i, j, k);
);
Sure, can't use commas here. Everything has its limitations,
and perfection is but a mirage :)
In this case, I'd have to write int j; int k; instead.
I have a long term # addiction and ISTR you can put all that function stuff inside brackets in the macro call and the comma problem goes away. Well I remember using () before, I guess {} will work too :) Anyway using the preprocessor is cheating and analogous to using loadstring(). I mean its not unreasonable to treat an entire lua file as just building a string which is then called at the end to do all the things that a "normal" lua file would do. Which gives you far more power than the C preprocessor.
--
Kriss
http://XIXs.com -><- http://www.WetGenes.com

AltStyle によって変換されたページ (->オリジナル) /