Change representation of dynamic arrays?

0ffh spam at frankhirsch.net
Fri Oct 19 22:27:34 PDT 2007


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?

> 2) It breaks the internal library support code, but that's my problem.

Si.

> 3) It breaks binary compatibility with libraries already compiled. But 
> we expect to break binary compatibility with D 2.0.

No sweat.

> 4) It breaks things like cast(ulong)str, if one was crazy enough to do 
> that anyway.

Never needed it... =)

> 5) It breaks anything that tries to look at the underlying 
> representation of dynamic arrays - but such code should be rewritten to 
> use .ptr and .length anyway, or slice notation.

Been a good boy and used .ptr and .length, so I'm fine with it... grin!

> So, what do you think?

I'm all for it!

Regards, Frank



More information about the Digitalmars-d mailing list