On Thu, 04 Jun 2009 21:31:07 +0300, Denis Koroskin <[email protected]>
wrote:
On Thu, 04 Jun 2009 22:16:42 +0400, Vladimir Panteleev
<[email protected]> wrote:
On Thu, 04 Jun 2009 05:10:17 +0300, Christopher Wright
<[email protected]> wrote:
bearophile wrote:
Christopher Wright:
Another good point. Or how do you index it by byte?
How can you read & write files of 3 bytes if voids are 4 bytes long
chunks? :o) I don't understand. I want to read and write files
byte-by-byte.
Bye,
bearophile
Vladimir was suggesting that void[] be the same as ubyte[] and that
you use void*[] if you might include a pointer. So that use case would
be safe.
Actually, I think Andrei's idea is better (to allow implicit casting
arrays of non-reference types to const(ubyte)[]). It introduces an
abstract no-pointers type, but still allows implicit casting to "might
have pointers".
There is a pitfall: should an "arrays of non-reference types" be
implicitly castable to const(byte)[] or const(ubyte[])[] ?
Should const(byte)[] also be implicitly castable to const(ubyte)[] (or
vice versa)?
I don't see why you'd want to work with arrays of signed bytes. It doesn't
make sense to allow implicit casting between the two; the programmer
should just pick one and stick with it. I think unsigned makes more sense.
--
Best regards,
Vladimir mailto:[email protected]