Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.std.c++ > #742

Macro replacement interpretation

Message-ID <meiemi$vtj$1@dont-email.me> (permalink)
Newsgroups comp.std.c++
From Edward Diener <eldiener@tropicsoft.invalid>
Subject Macro replacement interpretation
Organization A noiseless patient Spider
Date 2015-03-26 12:09 -0600

Show all headers | View raw


Section 16.3 paragraph 4 of the C++11 standard reads:

"If the identifier-list in the macro definition does not end with an
ellipsis, the number of arguments (including those arguments consisting of
no preprocessing tokens) in an invocation of a function-like macro shall
equal the number of parameters in the macro definition. Otherwise, there
shall be more arguments in the invocation than there are parameters in the
macro definition (excluding the ...). There shall exist a ) preprocessing
token that terminates the invocation."

Does this mean that invoking a macro with more arguments than there are
parameters in the identifier-list in the macro definition is not a
preprocessing error ?

Does this mean that invoking a macro with less arguments than there are
parameters in the identifier-list in the macro definition is a
preprocessing error ?

My testing with the major C++ compilers on Windows and Linux, including
gcc, clang, Intel, and Oracle but leaving out VC++ completely because its
preprocessor is so C++ standard non-conformant, shows that error messages
are usually produced if the number of arguments does not equal the number
of parameters in the identifier-list, but this is not always the case (
most notably with Oracle depending on the version ). This suggest that the
answer to my first question is NO and the answer to my second question is
YES. But I want to know the official answer on whether either situation
should be considered a compiler error or whether just a warning is
justified.



-- 
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]

Back to comp.std.c++ | Previous | NextNext in thread | Find similar


Thread

Macro replacement interpretation Edward Diener <eldiener@tropicsoft.invalid> - 2015-03-26 12:09 -0600
  Re: Macro replacement interpretation James Kuyper <jameskuyper@verizon.net> - 2015-03-27 14:07 -0600
  Re: Macro replacement interpretation Jakob Bohm <jb-usenet@wisemo.com> - 2015-03-29 03:01 -0600
    Re: Macro replacement interpretation Francis Glassborow <francis.glassborow@btinternet.com> - 2015-03-30 12:20 -0600
    Re: Macro replacement interpretation Edward Diener <eldiener@tropicsoft.invalid> - 2015-03-30 12:21 -0600
      Re: Macro replacement interpretation Francis Glassborow <francis.glassborow@btinternet.com> - 2015-03-31 15:39 -0600
        Re: Macro replacement interpretation James Kuyper <jameskuyper@verizon.net> - 2015-04-01 16:39 -0600
      Re: Macro replacement interpretation James Kuyper <jameskuyper@verizon.net> - 2015-03-31 15:38 -0600
        Re: Macro replacement interpretation Jakob Bohm <jb-usenet@wisemo.com> - 2015-04-01 16:38 -0600
          Re: Macro replacement interpretation James Kuyper <jameskuyper@verizon.net> - 2015-04-02 13:24 -0600
            Re: Macro replacement interpretation Francis Glassborow <francis.glassborow@btinternet.com> - 2015-04-03 14:30 -0600
        Re: Macro replacement interpretation Edward Diener <eldiener@tropicsoft.invalid> - 2015-04-03 14:30 -0600
          Re: Macro replacement interpretation James Kuyper <jameskuyper@verizon.net> - 2015-04-04 15:50 -0600

csiph-web