Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2010-03

Defining a constant record which contains an (dynamic or open) array

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Joost van der Sluis

Hi all,

I want to define a constant record, but the record contains an array. Is that possible? I've tried the code below and it doesn't work.

Compiler message: Fatal: Syntax error, "NIL" expected but "identifier TESTATTRIBUTES" found on the last line.

type
  TAllowAttribute= record
                    AttributeName: string;
                    AllowContent: string; //regex
                  end;
  TAllowAttributes= array of TAllowAttribute;
  TAllowTag= record
              TagName: string;
              AllowContent: string; //regex
              AllowAttributes: array of TAllowAttribute;
            end;
  TAllowTags = array of TAllowTag;
const
  testattributes : array[0..0] of TAllowAttribute =
       ((attributename:'style'; allowcontent:'.*'));
  testtags : TAllowTag =
       (tagname:'jojo'; allowcontent:'test'; AllowAttributes: testattributes);

Reply by email

Marco van de Voort
to Jonas Maebe

In our previous episode, Jonas Maebe said:

Show quoted text 10 lines
On 02 Mar 2010, at 09:14, Joost van der Sluis wrote: > I want to define a constant record, but the record contains an array. More specifically, a dynamic array. > Is that possible? Only with static arrays.

.. or with empty dyn array.

If you fill the dyn array field with "NIL" it will be accepted in both FPC and Delphi.

Reply by email