Idea: Introduce zero-terminated string specifier

Paulo Pinto pjmlp at progtools.org
Mon Oct 1 02:55:09 PDT 2012


On Monday, 1 October 2012 at 09:42:08 UTC, Piotr Szturmaj wrote:
> Jakob Ovrum wrote:
>> On Monday, 1 October 2012 at 09:17:52 UTC, Piotr Szturmaj 
>> wrote:
>>> Adam D. Ruppe wrote:
>>>> On Saturday, 29 September 2012 at 02:11:12 UTC, Alex Rønne 
>>>> Petersen
>>>> wrote:
>>>> Also this reminds me of the utter uselessness of the current 
>>>> behavior of
>>>> "%s" and a pointer - it prints the address.
>>>
>>> Why not specialize current "%s" for character pointer types 
>>> so it will
>>> print null terminated strings? It's always possible to cast 
>>> to void*
>>> to print an address.
>>
>> It's not safe to assume that pointers to characters are 
>> generally null
>> terminated.
>
> Yes, but programmer should know what he's passing anyway.

The thinking "the programmer should" only works in one man teams.

As soon as you start having teams with disparate programming 
knowledge among team members, you can forget everything about 
"the programmer should".

..
Paulo




More information about the Digitalmars-d mailing list