[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaMacro
- From: "Shane Lee" <shaneplee@...>
- Date: Thu, 3 Jan 2008 09:00:44 -0600
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