Behavior of {$if SizeOf(SOMETYPE) = 1} should be more clear in docs
Original Reporter info from Mantis: avra @zeljkoavramovic
-
Reporter name: Zeljko Avramovic
Original Reporter info from Mantis: avra @zeljkoavramovic
- Reporter name: Zeljko Avramovic
Description:
Looking at the documentation https://www.freepascal.org/docs-html/prog/progsu29.html I was expecting {$if SizeOf(TORDINALTYPE) = 1} to compile. At fpc-devel mail list Michael Van Canneyt has explained the reason why it can not compile, and agreed that I should file a documentation bug report to make documentation more clear.
Steps to reproduce:
This compiles and works well:
{$MACRO ON}
{$if SizeOf(byte) = 1}
WriteLn('SizeOf(byte) = ', SizeOf(byte));
{$endif}
however this does not compile:
{$MACRO ON}
{$define TMyOrdinalType := byte}
{$if SizeOf(TMyOrdinalType) = 1}
WriteLn('SizeOf(TMyOrdinalType) = ', SizeOf(TMyOrdinalType));
{$endif}
and creates this compilation error: Identifier not found "TMyOrdinalType"
Mantis conversion info:
- Mantis ID: 39266
- Build: 2021-07-13
- Version: 3.3.1