Re: Macro redefinition



Keith Thompson wrote:
Tor Rustad <tor_rustad@xxxxxxxxxxx> writes:
Dave Hansen wrote:

<snip>

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.

C99 6.10.3p2:

An identifier currently defined as an object-like macro shall not
be redefined by another #define preprocessing directive unless the
second definition is an object-like macro definition and the two
replacement lists are identical. Likewise, an identifier currently
defined as a function-like macro shall not be redefined by another
#define preprocessing directive 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.

This is a constraint.

Keith, I don't get your point. 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?

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



Relevant Pages

  • Re: Macro redefinition
    ... forget to #undef EXPAND_DEF before redefining it. ... An identifier currently defined as an object-like macro shall not ... two replacement lists are identical. ...
    (comp.lang.c)
  • Re: First sentence check
    ... Dim pos As Integer ... which is the insertion point when the macro is launched or the text ... what you need is a way to determine whether the paragraph ... It will show how many lists Word finds in your document. ...
    (microsoft.public.word.vba.general)
  • Re: Error Message Help
    ... Macro: Proj Lst Entry ... Open Project List and Project Entry Form ... Enter Proj Prop on Lists Options ...
    (microsoft.public.access.macros)
  • Re: First sentence check
    ... The line that you added applies the Normal style only to the Selection ... that is selected when the macro is launched. ... It will show how many lists Word finds in your document. ... Normal style or apply a non-list style, then apply bulleting or a style with ...
    (microsoft.public.word.vba.general)
  • Re: importing autocorrect / autotext entries
    ... You're probably right in your interpretation, in which case the macro would ... In that case it's the Default ACL that needs to be salvaged. ... text files or simple lists of words. ... in word 04 i was able to import both lists as autocorrect entries via ...
    (microsoft.public.mac.office.word)