This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [libstdc++ patch] Fix basic_string::_S_construct null pointer check
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Phil Edwards <phil at jaj dot com>
- Cc: Doug Gregor <dgregor at apple dot com>, libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: 14 Jul 2003 21:06:21 +0200
- Subject: Re: [libstdc++ patch] Fix basic_string::_S_construct null pointer check
- Organization: Integrable Solutions
- References: <BD01451F-B62B-11D7-8746-00039354D67A@apple.com><20030714190000.GA32577@disaster.jaj.com>
Phil Edwards <phil@jaj.com> writes:
| Couple of comments, Doug:
|
| 1) Can "Apple Mail" be told to do its attachments in text/plain instead
| of application/octet-stream?
|
| > --Apple-Mail-16-444405215
| > Content-Type: application/octet-stream; x-unix-mode=0644; name="string_construct_null.patch"
| > Content-Disposition: attachment; filename="string_construct_null.patch"
| > Content-Transfer-Encoding: 7bit
| >
| > *** basic_string.tcc 2003-07-04 21:05:34.000000000 -0700
| > --- /home/dgregor/basic_string.tcc 2003-07-14 11:46:46.000000000 -0700
| > ***************
| > *** 45,50 ****
| > --- 45,60 ----
| >
| > namespace std
| > {
| > + template<typename _Type>
| > + inline bool
| > + __null_pointer(_Type* __ptr)
| > + { return __ptr == 0; }
| > +
| > + template<typename _Type>
| > + inline bool
| > + __null_pointer(const _Type&)
| > + { return false; }
| > +
|
| I have a feeling these will come in handy in other files, but I can't
| think of a better place to put them right now.
include/bits/gnu-cxx-utility.h?
In the meantime:
|
| 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.
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())
// ...
But I do not have a strong feeling against __null_pointer being
renamed to __is_null_pointer.
| 3) This should go in __gnu_cxx, not std. Actually, this should go in
agreed.
| our internal-details namespace, but we haven't invented that name yet.
__gnu_cxx::__private?
-- Gaby