[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 4/4] Add a test suite for the sethostname module

From: Bruno Haible
Subject: Re: [PATCH 4/4] Add a test suite for the sethostname module
Date: Sun, 4 Dec 2011 19:45:51 +0100
User-agent: KMail/1.13.6 (Linux/; KDE/4.6.0; x86_64; ; )

Ben Walton wrote:
> In one of the subsequent tweaks to this test, you restored a space
> between the function name and the emtpy () at the call site for
> geteuid.  I realize I let some foo() slip through so it's
> understandable that you were doing a bunch of corrections.  Will this
> not break the use of the macro for platforms lacking geteuid though?
> ...
> -  if (geteuid () != 0)
> +  /* NOTE: the missing space between function name and () is
> +     intentional here so that in the event geteuid is derived from the
> +     macro above it will still work. */
> +  if (geteuid() != 0)

You have been misunderstanding how the C and C++ macro expansion process
works. The only place where a space before the open parenthesis is not
allowed is in the *definition* of a macro with arguments, like here:

# define geteuid() ((uid_t) -1)


# define geteuid () ((uid_t) -1)

For details, please see in ISO C:
section 6.10.3.

In memoriam Fred Hampton <http://en.wikipedia.org/wiki/Fred_Hampton>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]