Idea: Introduce zero-terminated string specifier

Adam D. Ruppe destructionator at gmail.com
Fri Sep 28 19:16:09 PDT 2012


On Saturday, 29 September 2012 at 02:11:12 UTC, Alex Rønne 
Petersen wrote:
> While the idea is reasonable, the problem then becomes that if 
> you accidentally pass a non-zero terminated char* to %sz, all 
> hell breaks loose just like with printf.

That's the same risk with to!string(), yes? We aren't really 
losing anything by adding it.

Also this reminds me of the utter uselessness of the current 
behavior of "%s" and a pointer - it prints the address.

I think this should be simply disallowed. If you want that, you 
can use %x, and if you want it printed, that's where the new %z 
comes in.


More information about the Digitalmars-d mailing list