Re: Macro redefinition



Ben Pfaff wrote:
Tor Rustad <tor_rustad@xxxxxxxxxxx> writes:
Tor Rustad <tor_rustad@xxxxxxxxxxx> writes:
Dave Hansen wrote:
My question is simply, is the above C code allowed?
It's a pretty common idiom in the code I work with. One caveat:
don't
forget to #undef EXPAND_DEF before redefining it.
Is really the #undef needed in this case? This is a function-like
macro, and the re-definition had identical argument list.
Doesn't the

"unless the second definition is a function-like macro definition that
has the same number and spelling of parameters, and the two
replacement lists are identical"

apply?

Your replacement lists are different: the first has
generate_source_1, the second has generate_source_2.

Ahh.. I see and learned something new! :-)

--
Tor <torust [at] online [dot] no>
.