This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [libstdc++ patch] Fix basic_string::_S_construct null pointer check


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]