Registriert seit: 6. Apr 2011
Ort: Berlin
3.070 Beiträge
Delphi 10.4 Sydney
|
Konstanten-Deklaration eines mehrdimensionalen Arrays
1. Jun 2015, 14:30
Hallo zusammen,
ich habe gerade einen gedanklichen Hänger nach dem Mittagessen.
Kann mir bitte jemand auf die Sprünge helfen?
Im folgenden Quelltext möchte ich ein zweidimensionales Array deklarieren, aber der Compiler sagt nö (E2026 Constant expression expected):
Delphi-Quellcode:
type
TSoundAddressData = record
Address : Integer;
Data : Integer;
end;
TSoundSources = array [1 .. 3] of TSoundAddressData;
TSoundChannels = array [1 .. 8] of TSoundSources;
const
CHANNEL_1 : TSoundSources =
(
(Address : $0; Data : $01), // NF1
(Address : $0; Data : $02), // NF2
(Address : $0; Data : $04) // NF3
);
CHANNEL_2 : TSoundSources =
(
(Address : $0; Data : $08),
(Address : $0; Data : $10),
(Address : $0; Data : $20)
);
CHANNEL_3 : TSoundSources =
(
(Address : $0; Data : $40),
(Address : $0; Data : $80),
(Address : $1; Data : $01)
);
CHANNEL_4 : TSoundSources =
(
(Address : $1; Data : $02),
(Address : $1; Data : $04),
(Address : $1; Data : $08)
);
CHANNEL_5 : TSoundSources =
(
(Address : $1; Data : $10),
(Address : $1; Data : $20),
(Address : $1; Data : $40)
);
CHANNEL_6 : TSoundSources =
(
(Address : $1; Data : $80),
(Address : $2; Data : $01),
(Address : $2; Data : $02)
);
CHANNEL_7 : TSoundSources =
(
(Address : $2; Data : $04),
(Address : $2; Data : $08),
(Address : $2; Data : $10)
);
CHANNEL_8 : TSoundSources =
(
(Address : $2; Data : $20),
(Address : $2; Data : $40),
(Address : $2; Data : $80)
);
CHANNELS : TSoundChannels =
(
CHANNEL_1, // <--- [dcc32 Error] BlaBlipBlup.pas(132): E2026 Constant expression expected
CHANNEL_2,
CHANNEL_3,
CHANNEL_4,
CHANNEL_5,
CHANNEL_6,
CHANNEL_7,
CHANNEL_8
);
|
|
Zitat
|