Overlay Record

Cusko
 
Avatar
 
Subject:

Overlay Record

 · 
Posted: 18.04.2011 - 15:16  ·  #1
Hi,

Why can't I overlay Array in Record. See the example under:
Code

type

  tSelect_LCD = record
                  LCDSelected : byte;
                  Reserved    : byte;
                end;

  tPacket   = Record
                Cmd      : word;
                Len      : word;
                prevMsg  : word;
                Data     : Array[0..255] of Byte;
              end;
var

  RecPacket  : tPacket;
  LCD [ @RecPacket.Data ] : tSelect_LCD;



Thank you,
Bostjan
rh
Administrator
Avatar
Gender:
Location: Germany
Age: 24
Homepage: e-lab.de
Posts: 5558
Registered: 03 / 2002
Subject:

Re: Overlay Record

 · 
Posted: 18.04.2011 - 22:14  ·  #2
Hello Bostjan,

this kind of overlay is not supported. But you can implement it in this way:
Code
type
  tPacket = Record
              Cmd                : word;
              Len                : word;
              prevMsg            : word;
              Data               : Array[0..255] of Byte;
              LCDSelected[@Data] : byte;
              Reserved[@Data+1]  : byte;
            end;

rolf
Cusko
 
Avatar
 
Subject:

Re: Overlay Record

 · 
Posted: 19.04.2011 - 00:07  ·  #3
Thank you Rolf. :happy:
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 14   64   78 · Page-Gen-Time: 0.023807s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI