Idea: Introduce zero-terminated string specifier

Steven Schveighoffer schveiguy at yahoo.com
Wed Oct 3 17:05:14 PDT 2012


On Wed, 03 Oct 2012 08:37:14 -0400, Regan Heath <regan at netmail.co.nz>  
wrote:

> On Tue, 02 Oct 2012 21:44:11 +0100, Steven Schveighoffer  
> <schveiguy at yahoo.com> wrote:
>> In fact, a better solution would be to define a C string type (other  
>> than char *), and just pretend those system calls return that.  Then  
>> support that C string type in writef.
>>
>> -Steve
>
> :D
> http://comments.gmane.org/gmane.comp.lang.d.general/97793
>

Almost what I was thinking.

:)

Though, at that point, I don't think we need a special specifier for  
writef.  %s works.

However, looking at the vast reach of these changes, I wonder if it's  
worth it.  That's a lot of prototypes to C functions that have to change,  
and a large compiler change (treating string literals as CString instead  
of char *), just so C strings print out with writef.  Not to mention code  
that will certainly break...

-Steve


More information about the Digitalmars-d mailing list