Recent

Author Topic: byte array declaration bug in LAMW  (Read 1331 times)

neuro

  • New Member
  • *
  • Posts: 26
byte array declaration bug in LAMW
« on: July 15, 2021, 04:14:05 am »
In Lazarus byte array can be declared in the following way:
Code: Pascal  [Select][+][-]
  1. const  myArray: array of byte = ($41,$43,$45,$45,$49,$53,$55,$55,$5A,$61,$63,$65,$65,$69,$73,$75,$75,$7A);
However LAMW fails to compile this code and throws error:
Quote
Fatal: Syntax error, ";" expected but "ordinal const" found

The workaround solution for this LAMW bug is to declare byte array as:
Code: Pascal  [Select][+][-]
  1. const  myArray: array [0..17] of byte = ($41,$43,$45,$45,$49,$53,$55,$55,$5A,$61,$63,$65,$65,$69,$73,$75,$75,$7A);

How to fix this byte array declaration bug in LAMW?
« Last Edit: July 15, 2021, 04:15:54 am by neuro »

ojz0r

  • New Member
  • *
  • Posts: 25
Re: byte array declaration bug in LAMW
« Reply #1 on: July 15, 2021, 09:02:00 am »
Don't you always have to declare lenght of array [0..n]?
Just trying to learn.

PascalDragon

  • Hero Member
  • *****
  • Posts: 3406
  • Compiler Developer
Re: byte array declaration bug in LAMW
« Reply #2 on: July 15, 2021, 09:09:52 am »
However LAMW fails to compile this code and throws error:
Quote
Fatal: Syntax error, ";" expected but "ordinal const" found

You need to use FPC 3.2.0 or newer. I don't know about LAMW, but at least for the FPC project 3.0.4 and older are no longer considered supported.

 

TinyPortal © 2005-2018