lua-users home
lua-l archive

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


At the risk of taking this further off-topic, I'd like to put my 2
cents in. I use macros in C for a variety of reasons, but for the most
part they take the place of repeating lines of code. For instance:
searching large linked-lists with a variety of variables which may be
of varying types. I also use them for simplifying tasks that are
repeated in several functions like so:

(macro)
#define PLURAL(i)		((i) != 1 ? "s" : "")

(code)
snprintf(tmp, MAX_BUFFER, "%-20 Event%s running.", top_ev, PLURAL(top_ev));
log(stdin, tmp);

So, to sum up what I really mean: I use macros to save time in
writing, not for readability, since my macros can tend to become large
enough to qualify as full-blown functions and without documentation
can tend to obfuscate my programs.

-Shane