On Sun, 18 Jul 2021, Zeljko Avramovic via fpc-devel wrote:
As discussed at https://forum.lazarus.freepascal.org/index.php/topic,55397.0.html, 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" Looking at the documentation https://www.freepascal.org/docs-html/prog/progsu29.html I was expecting {$if SizeOf(TORDINALTYPE) = 1} to compile.
Why are you expecting it ? TOrdinalType is not an identifier. It's a macro that resolved to an identifier. Macros are not expanded in directives.
If I am reading it correctly, then I should either file a documentation bug report to make documentation more clear, or a feature bug report where this $IF example is not behaving as it should. Which should I report?
Documentation bug. Michael. _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel