July 12, 2004 Array reference behavior documentation (for Walter) | ||||
---|---|---|---|---|
| ||||
I noticed a behavior that I didn't expect. When an array is cast, it simply changes the pointer type. An exception is something like the following: cast(wchar[])"hello" which actually makes "hello" a wchar[] array. Maybe it's just a lack of a strong C backround (I'm coming from Java) but I didn't expect that behavior, although I rather like it. It might be useful for some to have that noted somewhere in the specs, as I don't recall seeing it there. John |
July 12, 2004 Re: Array reference behavior documentation (for Walter) | ||||
---|---|---|---|---|
| ||||
Posted in reply to teqDruid | On Mon, 12 Jul 2004 02:44:10 -0400, teqDruid <me@teqdruid.com> wrote: > I noticed a behavior that I didn't expect. When an array is cast, it > simply changes the pointer type. An exception is something like the > following: > cast(wchar[])"hello" > which actually makes "hello" a wchar[] array. Maybe it's just a lack of a > strong C backround (I'm coming from Java) but I didn't expect that > behavior, although I rather like it. > > It might be useful for some to have that noted somewhere in the specs, as > I don't recall seeing it there. I like it too, however, I just made a post to the bugs group saying that this should convert the format of the data in the array, so I'm contradicting myself here when I say... I think it's best if the above is the case, and documented somewhere, if we want to convert the contents/data to a new format then we use a library function. I think this gives us the most flexibility. Regan. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ |
Copyright © 1999-2021 by the D Language Foundation