Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-03

fpc 2.3.1 doesn't allow to pass literal constants as formal const parameter

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Vincent Snijders
Currently fpc 2.3.1 cannot build lazarus anymore. It fails on lines like
MyStream.Write(' ',1);
The write method is declared as
   function Write(const Buffer; Count: Longint): Longint

Why isn't passing literal constant to a formal const parameter allowed anymore?

Vincent

Reply by email

Felipe Monteiro de Carvalho
to Vincent Snijders
Vincent Snijders wrote
Currently fpc 2.3.1 cannot build lazarus anymore. It fails on lines like MyStream.Write(' ',1);

One idea to solve this in a good way might be:

MyStream.Write(' ', SizeOf(Char));

or multiples of sizeof(char) for many characters

I just thougth about why I've never hit this before and I think it's because I usually use sizeof to fill that field instead of using a number.

Felipe Monteiro de Carvalho

Reply by email