This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Expand mempcpy into memcpy


On 02/06/13 12:05, Andreas Schwab wrote:
> #define COMMA ,
> #define a(x) b(x)
> #define b(x,y) ...
> a(w COMMA z)

Oh my, that's a good one!  I realize this is a
distraction but I can't resist following up.
Programs that try to use that trick with standard
function-like macros are not strictly conforming, right?
For example:

#include <stdio.h>
#define COMMA ,
int
main (void)
{
  return putc ('\n' COMMA stdout);
}

putc is allowed to be a macro, and the program is
then calling the macro with the wrong number of
macro arguments, so an implementation is allowed
to reject this program with a diagnostic.  Which
means the glibc putc implementation is OK:

#define putc(_ch, _fp) _IO_putc (_ch, _fp)

An implementation is also allowed to accept the
above program, if putc is not a macro.

There might be an issue with varargs functions,
perhaps, but that's not the case here.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]