Recent

Author Topic: Compiler options doesn't work  (Read 7937 times)

clandestino

  • Newbie
  • Posts: 3
Compiler options doesn't work
« on: October 28, 2006, 08:44:45 am »
Under Win32, it seems that lazarus uses -S2 as a default compiler option.

As seen in a french Forum, freepascal has a little bug, ie with this option it doesn't want to compile this code :

Code: [Select]

type
  MyClass = class
  private
// some private declarations
  public
        function IsGonnaMakeItBug: string;
        procedure MyProc(IsGonnaMakeItBug: extended);
end;


Because it doesn't allow the use of the same name for this function and the var in the next proc... Strange behaviour 'cause this code is correct and works on Delphi 2.


However, freepascal can compile it using -Sd with no message error.

I tried to change the option in lazarus IDE using (in french)
projet>>options du compilateur>>Analyse  
and I chose -Sd ...

Lazarus still couldn't compile.

I tried to manually define this option in fpc.cfg in C:\lazarus\pp\bin\i386-win32 and it doesn't work  :cry:

Of course I can just change the name of one of two items to solve this issue, but this example shows that Lazarus chooses its compiler options and the user can't change them... Is it a bug?

Does anyone have the solution?

Thancks...
Clandestino

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1933
Re: Compiler options doesn't work
« Reply #1 on: October 28, 2006, 11:28:08 am »
Quote from: "clandestino"

Does anyone have the solution?


I don't understand it completely either but if you

uncomment {$mode objfpc} in the unit and set -Sd in options menu

OR

explicitely set {$mode delphi} in the unit

then it works.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Compiler options doesn't work
« Reply #2 on: October 28, 2006, 02:35:12 pm »
Quote from: "clandestino"
As seen in a french Forum, freepascal has a little bug, ie with this option it doesn't want to compile this code :


I think this is not a bug. Mode objfpc is much stricter then mode Delphi, and doesn´t allow this.

clandestino

  • Newbie
  • Posts: 3
Compiler options doesn't work
« Reply #3 on: October 29, 2006, 05:37:30 pm »
The point is so obvious  :oops:
It's a shame I didn't see it by myself.
I Now understand why my actions in the compiler option dialog box didn't change anything.
Thank you very much for your help...

P.S.
However I still consider free pascal has a little bug cause it doesn't compile the code I'm talking about when it's in mode -S2 (with no {$mode objfpc})
Mode S2 (=$mode objfpc})is supposed to be Delphi2 compatible, and Delphi 2 accepts this code...
This is not related to Lazarus so my problem here is solved.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Compiler options doesn't work
« Reply #4 on: October 29, 2006, 06:13:26 pm »
Quote from: "clandestino"
P.S.
However I still consider free pascal has a little bug cause it doesn't compile the code I'm talking about when it's in mode -S2 (with no {$mode objfpc})
Mode S2 (=$mode objfpc})is supposed to be Delphi2 compatible, and Delphi 2 accepts this code...


Where did you read that mode objfpc is supposed to be Delphi 2 compatible? AFAIK Objfpc is Free Pascal specific, and isn't necessarely compatible with any delphi version.

 

TinyPortal © 2005-2018