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:05:28 -0400
On Mon, Jul 8, 2019 at 4:31 PM Thiago Macieira <thiago_at_[hidden]> wrote:

> I'd like that. Who's going to modify the glibc headers so we can do that?
>

The glibc authors?

Once we have named argument association, there can be additional
declarations
of functions using better parameter names. That is, we can have both

extern ssize_t write (int __fd, const void *__buf, size_t __n) __wur;

and (I don't know what the __wur is)

extern ssize_t write (int fd, const void *buf, size_t n);
extern ssize_t write (int fd, const void *buffer, size_t count);

There will need to be some resolution about what it means to define macros
that alias
parameter names, or maybe modules will save us. It's nonsensical to have
all names
be uglified like this anyway, especially since it's a solution that's
specifically illegal for
ordinary users. Maybe just protect the new declarations with

#if defined(fd) || defined(buf) || defined(n)
#error some function parameter names defined as macros
#endif

Received on 2019-07-08 16:07:34