Change representation of dynamic arrays?
Walter Bright
newshound1 at digitalmars.com
Fri Oct 19 22:54:24 PDT 2007
0ffh wrote:
> Walter Bright wrote:
>> [see news://news.digitalmars.com:119/ffbr56$r40$1@digitalmars.com]
>> What does this break?
>> 1) Passing dynamic arrays to printf as in:
>> printf("my string is %*.s\n", str);
>
> Hmmm, currently I use printf("foo %s\n",std.string.toStringz(bar))
> anyway, never tried what you're doing there. Did I miss something?
printf("my string is %*.s\n", str.length, str.ptr);
will be a little faster, because it doesn't need to allocate memory.
More information about the Digitalmars-d
mailing list