This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [libstdc++ patch] Fix basic_string::_S_construct null pointer check
On Mon, Jul 14, 2003 at 09:06:21PM +0200, Gabriel Dos Reis wrote:
> Phil Edwards <phil@jaj.com> writes:
> |
> | 2) Please name the function __is_null_pointer or __null_pointer_p
> | or something like that, to make it clear this is a predicate function.
>
> Wait a minute. First, please let's not propagate the Lisp disease we
> have in the front-end, i.e. __null_pointer_p is a no-no from my point
> of view.
Absolutely right. Even (enlightened) Lispers don't do that any more.
> Secondly, what are the use cases of __null_pointer()? In conditional
> branch I guess, i.e.
>
> if (__null_pointer(p))
> // ...
>
> this is consistent with the rest of the standard library, e.g.:
>
> if (stream.fail())
> // ...
Iostream names are an embarrassment, grandfathered into the standard.
There's no more reason to propagate bad iostream naming conventions
than to propagate bad Lisp naming conventions.
> But I do not have a strong feeling against __null_pointer being
> renamed to __is_null_pointer.
I have very strong feelings in favor of "is", "has", etc. prefixes
on predicate names. We should have text in the style guide calling
for it.
BTW, a snapshot of a pretty comprehensive C++ style guide I wrote for
Zembu may be found at <http://cantrip.org/coding-sandard.html>. It
served as the basis for the (not yet finished) Boost.org guidelines.
Not everything in there is universally applicable, but it might be
helpful to read.
Nathan Myers
ncm-nospam@cantrip.org