> I personally do not feel it is worth the effort. It's easy to use a
> more powerful macro processor, such as m4, to generate your C code. The
> benefit of building a more powerful macro processor into the language
> proper seems minimal.
>
> This particular extension seems problematic when cross-compiling. In
> what environment should the expressions be evaluated?


why
 are you asking for a specific environment? it's coding convenience and 
elegance for coding in c itself. simplest case scenario is what i've 
already mentioned in my very first email.

alright, i'll repeat myself (in case you haven't read the whole thread)...
say
 you have different macros, FUNC_MACRO1, FUNC_MACRO2, FUNC_MACRO3, ... 
whichever macro to be used can be indexed 1, 2, 3... so forth. the index
 is conveniently described in an arithmetic expression, as it usually 
arises even if just programming in plain c.



#define CONCAT(a, b)             a##b

#define CONCAT_VAR(a, b)         CONCAT(a, b)

 

#define FUNC_MACRO(N)            CONCAT_VAR(FUNC_MACRO_, N)



invoking with FUNC_MACRO(1), FUNC_MACRO(2), so forth... will work. but 
like i said, it's usually described by an arithmetic macro expression. so if 
you have this:



#define N          a + b/c



and use it later on:



FUNC_MACRO(N), will expand to:

FUNC_MACRO_a + b/c



which is wrong.



it alleviates the need to write external files in, say, m4, even
 if the macro is just a few lines long; and having to go back and forth 
with another language (for us novices).
                                          

Reply via email to