[fpc-devel] {$if SizeOf(TMyOrdinalType) = 1} doesn't compile

Zeljko Avramovic avra at writeme.com
Sun Jul 18 13:55:45 CEST 2021


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. 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?




More information about the fpc-devel mailing list