The more interesting question

Jonathan M Davis jmdavisProg at gmx.com
Fri May 18 12:10:45 PDT 2012


On Friday, May 18, 2012 11:18:46 Steven Schveighoffer wrote:
> On Fri, 18 May 2012 11:05:21 -0400, Christophe Travert
> 
> <travert at phare.normalesup.org> wrote:
> > "Steven Schveighoffer" , dans le message (digitalmars.D:167556), a
> > 
> >> toStringz can allocate a new block in order to ensure 0 gets added.
> >> This
> >> is ludicrous!
> >> 
> >> You are trying to tell me that any time I want to call a C function
> >> with a
> >> string literal, I have to first heap-allocate it, even though I *know*
> >> it's safe.
> > 
> > How about "mystring\0".ptr ?
> 
> AKA "mystring" :)
> 
> I'm sorry, I don't see the reason to require this. All for the sake of
> making "" a null slice. I find the net gain quite trivial.

And I find the net gain to be negative, since the fact that "" is non-null is 
_useful_.

- Jonathan M Davis


More information about the Digitalmars-d mailing list