Sign in Join

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

Mailing lists / fpc-devel / 2006-05

Trouble with FPC version.

5 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

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

Alexander Todorov

Hello,
I use a custom written defines set to determine the fpc version.

-----------------------------------------------------------------------------------------------------------------------------------
program project1;
{$mode objfpc}{$H+}
uses SysUtils;
// fpc 2.0.0
{$IF ((FPC_VERSION = 2) and (FPC_RELEASE = 0) and (FPC_PATCH = 0))}
   {$DEFINE FPC_VER_200}
{$ENDIF}
// fpc 2.0.1
{$IF ((FPC_VERSION = 2) and (FPC_RELEASE = 0) and (FPC_PATCH = 1))}
   {$DEFINE FPC_VER_201}
{$ENDIF}
// fpc >= 2.0.1
{$IF ((FPC_VERSION >= 2) and (FPC_RELEASE >= 0) and (FPC_PATCH >= 1))}
   {$DEFINE FPC_VER_201+}
{$ENDIF}
// fpc = 2.0.2
{$IF ((FPC_VERSION = 2) and (FPC_RELEASE = 0) and (FPC_PATCH = 2))}
   {$DEFINE FPC_VER_202}
{$ENDIF}
begin
   {$IFDEF FPC_VER_200}
   writeln('version 2.0.0');
   {$ENDIF}
   {$IFDEF FPC_VER_201}
   writeln('version 2.0.1');
   {$ENDIF}
   {$IFDEF FPC_VER_201+}
   writeln('version 2.0.1+');
   {$ENDIF}
   {$IFDEF FPC_VER_202}
   writeln('version 2.0.2');
   {$ENDIF}

end.
--------------------------------------------------------------------------------------------------------------------------------- the output from this is:
version 2.0.1
version 2.0.1+
version 2.0.2

I am compiling with FPC 2.0.2. Is this a bug or I have wrong defines???? I have to switch to VER2_0_1, VER2_0_2 compiler defines, but how to make a 2.0.1+ with those?

Thanks.

Reply by email

Florian Klaempfl
to Alexander Todorov
Alexander Todorov wrote 24 lines
Hello, I use a custom written defines set to determine the fpc version. ----------------------------------------------------------------------------------------------------------------------------------- program project1; {$mode objfpc}{$H+} uses SysUtils; // fpc 2.0.0 {$IF ((FPC_VERSION = 2) and (FPC_RELEASE = 0) and (FPC_PATCH = 0))} {$DEFINE FPC_VER_200} {$ENDIF} // fpc 2.0.1 {$IF ((FPC_VERSION = 2) and (FPC_RELEASE = 0) and (FPC_PATCH = 1))} {$DEFINE FPC_VER_201} {$ENDIF} // fpc >= 2.0.1 {$IF ((FPC_VERSION >= 2) and (FPC_RELEASE >= 0) and (FPC_PATCH >= 1))} {$DEFINE FPC_VER_201+}

This is assumed to be FPC_VER_201. + isn't a valid character for an id?

Show quoted text 40 lines
{$ENDIF} // fpc = 2.0.2 {$IF ((FPC_VERSION = 2) and (FPC_RELEASE = 0) and (FPC_PATCH = 2))} {$DEFINE FPC_VER_202} {$ENDIF} begin {$IFDEF FPC_VER_200} writeln('version 2.0.0'); {$ENDIF} {$IFDEF FPC_VER_201} writeln('version 2.0.1'); {$ENDIF} {$IFDEF FPC_VER_201+} writeln('version 2.0.1+'); {$ENDIF} {$IFDEF FPC_VER_202} writeln('version 2.0.2'); {$ENDIF} end. --------------------------------------------------------------------------------------------------------------------------------- the output from this is: version 2.0.1 version 2.0.1+ version 2.0.2 I am compiling with FPC 2.0.2. Is this a bug or I have wrong defines???? I have to switch to VER2_0_1, VER2_0_2 compiler defines, but how to make a 2.0.1+ with those? Thanks. _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Alexander Todorov
to Florian Klaempfl
Florian Klaempfl wrote
This is assumed to be FPC_VER_201. + isn't a valid character for an id?

You are right. Changing + to P solved my touble.
But FPC should complain about the '+' character, or should not? Bug?

Reply by email

Marco van de Voort
to Alexander Todorov
Show quoted text 5 lines
On 5/4/06, Florian Klaempfl wrote: > This is assumed to be FPC_VER_201. + isn't a valid character for an id? You are right. Changing + to P solved my touble. But FPC should complain about the '+' character, or should not? Bug?

Afaik this is on purpose. In Delphi comments can follow after a directive.

Reply by email

Geno Roupsky
to Marco van de Voort

2006/5/4, Marco van de Voort :

Show quoted text 10 lines
> On 5/4/06, Florian Klaempfl wrote: > > This is assumed to be FPC_VER_201. + isn't a valid character for an id? > > You are right. Changing + to P solved my touble. > But FPC should complain about the '+' character, or should not? Bug? Afaik this is on purpose. In Delphi comments can follow after a directive.

Can it be done only in {$mode delphi} to allow this, in others to require at least a space after the define name or give a warning of some kind?

Geno Roupsky

Reply by email