C++ Logo

std-proposals

Advanced search

Re: Making parameter names clearer than func(true, false);

From: Hyman Rosen <hyrosen_at_[hidden]>
Date: Mon, 8 Jul 2019 17:17:31 -0400
On Mon, Jul 8, 2019 at 5:05 PM Hyman Rosen <hyrosen_at_[hidden]> wrote:

> Maybe just protect the new declarations with
>
> #if defined(fd) || defined(buf) || defined(n)
> #error some function parameter names defined as macros
> #endif
>

Better yet, standardize macro push/pop preservation:

#push fd buf n
extern ssize_t write (int fd, const void *buf, size_t n);
#pop fd buf n

where #push name,... saves the macro definitions of all the names (if
they're
defined) and undefines those names, and #pop name,... restores the macro
definitions of those names (if they were defined). I would make #push/#pop
with
no names do the effect for all macros, but ymmv.

Received on 2019-07-08 16:19:36