Idea: Introduce zero-terminated string specifier
Paulo Pinto
pjmlp at progtools.org
Sun Sep 30 23:59:01 PDT 2012
On Sunday, 30 September 2012 at 20:27:16 UTC, Andrej Mitrovic
wrote:
> On 9/30/12, deadalnix <deadalnix at gmail.com> wrote:
>> If you know that a string is 0 terminated, you can easily
>> create a slice
>> from it as follow :
>>
>> char* myZeroTerminatedString;
>> char[] myZeroTerminatedString[0 ..
>> strlen(myZeroTerminatedString)];
>>
>> It is clean and avoid to modify the stdlib in an unsafe way.
>>
>
> What does that have to do with writef()? You can call
> to!string, but
> that's beside the point. The point was getting rid of this
> verbosity
> when using C APIs.
You should anyway wrap those APIs not to pollute D call with
lower level APIs.
As such I don't find the verbosity, as you put it, that much of
an issue.
Then again, I favor the Pascal family of languages for systems
programming.
--
Paulo
More information about the Digitalmars-d
mailing list