[libstdc++ patch] Fix basic_string::_S_construct null pointer check
Phil Edwards
phil@jaj.com
Mon Jul 14 19:00:00 GMT 2003
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. 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.
Reading the code where it was used made me think at first that the
function creates and returns a null pointer.
3) This should go in __gnu_cxx, not std. Actually, this should go in
our internal-details namespace, but we haven't invented that name yet.
> --Apple-Mail-16-444405215
> Content-Type: application/octet-stream; x-unix-mode=0644; name="string_construct_null.ChangeLog"
> Content-Disposition: attachment; filename="string_construct_null.ChangeLog"
> Content-Transfer-Encoding: 7bit
>
> 2003-07-14 Doug Gregor <dgregor@apple.com>
> * include/bits/basic_string.tcc (basic_string::_S_construct):
> Fix null pointer check.
> * include/bits/basic_string.tcc (__null_pointer): New.
Please put a blank line after the date/name/email bit, for the sake of
GNU-changelog-style parsers.
Phil
--
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace. We seek
not your counsel, nor your arms. Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen. - Samuel Adams
More information about the Gcc-patches
mailing list