mod operator in constants not allowed

trevor <[email protected]>
Newsgroups gmane.comp.compilers.gpc
Message-ID <[email protected]>
as title, I get a compile error when I use the mod operator in constant 
expressions.

eg, with this program ...



     program pmod (Output);
     const
         c = 9 mod 5;    { <<<< error }
     begin
        WriteLn ('9 mod 5 is ', c);
     end. { pmod }

pmod.pas:3: error: constant has non-constant value


I can rewrite the constant as

     c = 9 - 5*(9 div 5);   { this is equivalent to 9 mod 5 }

without problems.

This seems strange to me -  am I missing something?
What makes it a non-constant?

Many Thanks


_______________________________________________
Gpc mailing list
[email protected]
https://www.g-n-u.de/mailman/listinfo/gpc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.