This gives me "Error in type definition”. A bug?
type
TMyRec = record
type
T = 0..256**4;
end;Regards,
Ryan Joseph

Mailing lists / fpc-pascal / 2024-11
6 messages · 3 people ·
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
This gives me "Error in type definition”. A bug?
type
TMyRec = record
type
T = 0..256**4;
end;Regards,
Ryan Joseph
Hairy Pixels via fpc-pascal schrieb am
Do., 14. Nov. 2024, 06:24:
The **-operator is not *implemented* by the compiler. It's provided through the Math unit. Thus you can't use it in constant declarations.
Regards,
Sven
On Nov 14, 2024 at 1:53:17 PM, Sven Barth via fpc-pascal <
Why is that? That means you can do powers in types or constants right?
Regards,
Ryan Joseph
Only a limited numbers of functions are implemented as compile-time functions. This is so in every compiler.
Regards,
Adriaan
On Nov 14, 2024 at 1:53:17 PM, Sven Barth via fpc-pascal < Why is that? That means you…
Hairy Pixels via fpc-pascal schrieb am
Do., 14. Nov. 2024, 08:03:
Because it wasn't deemed necessary that the compiler itself provides this operator.
That means you can do powers in types or constants right?
I assume you mean "can't". In that case, yes, that is not possible.
Regards,
Sven
On Nov 14, 2024 at 8:11:53 PM, Sven Barth via fpc-pascal <
You can use it to create ordinal types from bytes using a generic. I was trying to do something like this. If you do other operations on constants it makes to include powers too. Of course you can solve this a number of other ways too but I preferred this one.
type
SomeInt<const A, B: Byte> = record
header: 0..(256**A) - 1;
footer: 0..(256**B) - 1;
end;SomeInt<4, 3>
Regards,
Ryan Joseph