bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH 1/2] mark functions with const and pure attributes


From: Bruno Haible
Subject: Re: [PATCH 1/2] mark functions with const and pure attributes
Date: Sun, 1 May 2011 19:17:57 +0200
User-agent: KMail/1.9.9

Paul Eggert wrote:
> > +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
> 
> The names _GL_ATTRIBUTE_PURE and _GL_ATTRIBUTE_CONST seem
> gratingly long to me; when reading a function signature they
> get in the way of other important information.
> ...
> renaming them to _GL_PURE and _GL_CONST?  When used in context
> the shorter names shouldn't be confusing.

I disagree. Especially _GL_CONST would be very confusing to everyone
who knows that glibc headers use __const for 'const', that gnulib
defines _Restrict_ for 'restrict' - people would think that _GL_CONST
expands to 'const'.

> Also, these two names use a different naming convention from _GL_UNUSED.

_GL_UNUSED is a shorter name because it needs to be placed inside an
argument list. Whereas in Jim's patch all occurrences of _GL_ATTRIBUTE_PURE
and _GL_ATTRIBUTE_CONST are in lines that have enough room.

It would be possible to make the names a little bit shorter by calling
them _GL_CONST_FUNCTION and _GL_PURE_FUNCTION. But even that would be
inconsistent with _GL_ATTRIBUTE_FORMAT that we use in stdio.in.h.

In summary, I'm very much in favour of keeping _GL_ATTRIBUTE_PURE and
_GL_ATTRIBUTE_CONST. It's unambiguous, easy to understand, and consistent
with _GL_ATTRIBUTE_FORMAT.

Bruno
-- 
In memoriam Itzhak Katzenelson <http://en.wikipedia.org/wiki/Itzhak_Katzenelson>



reply via email to

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