"Carsten Haerle" <
[hidden email]> wrote in message
news:brkk9h$8vs$03$
[hidden email]...
> ..
> the following code raises an Exception "Can't a DWORD"
>
> a := #[0 0 0 0].
> a dwordAtOffset: 0 put: (DWORD fromInteger: 16rFFFFFFFF).
> ...
> The exception occurs in the method ByteArray>>retryDwordAtOffset:put:
which
> seems to have an off by one error. In Addition the implementation comment
> seems to be totally wrong. Below a fixed version:
> ...
Thanks Carsten. Recorded as bug #1457.
>
> In addition almost the same code has been copied to
> ByteArray>>basicDwordAtOffset:put: (which already has a corrected comment
> but still the wrong code). I thing it should also use the method
> #retryDwordAtOffset:put: as shown below.
>
> Why are there two method anyway?
>
This is so that the ExternalAddress subclass can discriminate between
setting the address (i.e. setting up the pointer), or writing at some offset
from the address (i.e. using it as a pointer). The basic version can't use
#retryDwordAtOffset:put: because that would then give incorrect behaviour
for subclasses.
I'll correct the relational test on the upper bound in
#basicDwordAtOffset:put: under the same defect number, and do the same for
#retryWordAtOffset:put: which suffers from the same error too.
Regards
Blair