I wrote to Bart:

> > Type
> >   SubRange = Chr(1)..Chr(2);
> > begin
> > end.
> >
> > This compiles in TP 6.0 and Delphi 7.0, but fpc doesn't.
>
> It also compiles in BP 7.0, but why? I think it can work
> only if the compilers treats Chr(1) as a macro, not as a
> function. Does any dialect Pascal allow function
> invocations in type definitions?

The Borland Pascal manual explains it:

   A constant expression is an expression that can be
   evaluated by the compiler without actually executing a
   program.
   [...]
   these constructs are not allowed in constant expres-
   sions:
   [...]
   function calls (except the following)

   Abs     Chr
   Hi      Length
   Lo      Odd
   Ord     Pred
   Ptr     Round
   SizeOf  Succ
   Swap    Trunc

Did you try compiling it with FreePascal in Borland mode?

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to