Newbie Question - memory overlays

Chris Miller chris at dprogramming.com
Sun Oct 22 19:15:54 PDT 2006


On Sun, 22 Oct 2006 21:54:51 -0400, Jacques Collin  
<zerozerosix at hotmail.com> wrote:

> My apologies if this has been answered before -- in which case,
> kindly point me to the source.
>
> Delphi (Borland) allows one to overlay memory variables
>
> " To create a new variable that resides at the same address as an
> existing variable, use the name of the existing variable (instead
> of an address) after the word absolute. For example,
>
>   var
>      Str: string[32];
>      StrLen: Byte absolute Str;
>
> specifies that the variable StrLen should start at the same
> address as Str. "
>
> Question: Does D implement somrthing similar?
> This yould be useful if I could refer to a slice of a vector by a
> different name.
>
> --- thanks --

Try a union, http://www.digitalmars.com/d/struct.html
where each field starts at the union's start address.



More information about the Digitalmars-d mailing list