Change representation of dynamic arrays?

Daniel Keep daniel.keep.lists at gmail.com
Sat Oct 20 00:27:42 PDT 2007



Janice Caron wrote:
> On 10/20/07, Janice Caron <caron800 at googlemail.com> wrote:
>> On 10/20/07, Daniel Keep <daniel.keep.lists at gmail.com> wrote:
>>> tst.end   = str.start + ((str.end-str.start)-e)*wchar.sizeof;
>> tst.end = str.end - e*wchar.sizeof;
> 
> See, the $ wouldn't expand to (str.end-str.start) as you implied, it

Ah yes, silly me for quoting something Walter wrote without thinking
about it first.  :P

> would expand to ((str.end-str.start)/wchar.sizeof). Obviously the two
> str.starts cancel each other out, so you can adjust the end pointer
> (relative to $) without looking at the start pointer at all.

Assuming the compiler is smart enough to do algebraic elimination.
I think I'll also have to take a look at what code the compiler
generates in these cases.

	-- Daniel



More information about the Digitalmars-d mailing list