[fpc-pascal] How to init Array values in a record?
Jonas Maebe
jonas.maebe at elis.ugent.be
Thu Feb 4 17:55:18 CET 2010
On 04 Feb 2010, at 17:32, yu ping wrote:
> I use :
> tbrbtns:array[0..5] of TBBUTTON =(
>
> (iBitmap:7;idCommand:10000;fsState:TBSTATE_ENABLED;fsStyle:TBSTYLE_BUTTON;dwData:0;iString:0),
>
> (iBitmap:8;idCommand:10001;fsState:TBSTATE_ENABLED;fsStyle:TBSTYLE_BUTTON;dwData:0;iString:0),
>
> (iBitmap:0;idCommand:0;fsState:TBSTATE_ENABLED;fsStyle:TBSTYLE_SEP;dwData:0;iString:0),
>
> (iBitmap:0;idCommand:10002;fsState:TBSTATE_ENABLED;fsStyle:TBSTYLE_BUTTON;dwData:0;iString:0),
>
> (iBitmap:1;idCommand:10003;fsState:TBSTATE_ENABLED;fsStyle:TBSTYLE_BUTTON;dwData:0;iString:0),
>
> (iBitmap:2;idCommand:10004;fsState:TBSTATE_ENABLED;fsStyle:TBSTYLE_BUTTON;dwData:0;iString:0)
> );
> compile success,I don't know why
Probably because you are using Delphi mode. Delphi allows skipping record fields in typed constant declarations, so FPC in Delphi mode also allows this. FPC will still give a warning in this case though. In other syntax modes, you get an error if you skip fields.
Jonas
More information about the fpc-pascal
mailing list