2009-11-08 15:37:51

by Jan Engelhardt

[permalink] [raw]
Subject: Re: [PATCH v4 01/12] vsprintf: factorize "(null)" string


Stripping the humongous Cc list for sanity.


On Saturday 2009-11-07 16:16, André Goddard Rosa wrote:

>Change "<NULL>" to "(null)" and make it a static const char[] hoping that
>the compiler will make null_str a label to a read-only area containing it.

Hoping? Nah, thanks.

>See:
>http://udrepper.livejournal.com/13851.html

Ulrich's example already _has_ a variable that is then changed from
const char * to const char[]. Of course doing that will save you the
extra pointer.

But vsprintf.c on the other hand did not have that extra variable to
begin with! But it is ok nevertheless, and the unification of <NULL> vs
(null) is worthwhile.


2009-11-08 15:49:33

by André Goddard Rosa

[permalink] [raw]
Subject: Re: [PATCH v4 01/12] vsprintf: factorize "(null)" string

On Sun, Nov 8, 2009 at 1:37 PM, Jan Engelhardt <[email protected]> wrote:
>
> Stripping the humongous Cc list for sanity.
>
>
> On Saturday 2009-11-07 16:16, Andr? Goddard Rosa wrote:
>
>>Change "<NULL>" to "(null)" and make it a static const char[] hoping that
>>the compiler will make null_str a label to a read-only area containing it.
>
> Hoping? Nah, thanks.

:) That's just because I don't always trust gcc blindly. :)

>>See:
>>http://udrepper.livejournal.com/13851.html
>
> Ulrich's example already _has_ a variable that is then changed from
> const char?* to const char[]. Of course doing that will save you the
> extra pointer.
> But vsprintf.c on the other hand did not have that extra variable to
> begin with!

Correct, of course! Most relevant reference is the first one:
http://people.redhat.com/drepper/dsohowto.pdf part 2.4.2

The others are just related/akin to the topic; interesting nevertheless.

> But it is ok nevertheless, and the unification of <NULL> vs
> (null) is worthwhile.

Thanks,
Andr?