Sign in Join

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

Mailing lists / fpc-devel / 2008-09

Strange problem with -M and -S command-line options

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Aleksa Todorovic

Hi!

I've just hit this problem, and wanted to report it, so someone can tell me if this is FPC or Lazarus bug.

==================
Compiler version: 2.2.2
Lazarus version: svn trunk (revision 16671)
Description: If -Sh is used before -Mobjfpc on command-line, string is interpreted as ShortString, not AnsiString.
Usage problem: The latest version of Lazarus generates command-line with -Sh option before -Mobjfpc.
Reproducability: Always
==================
program test_string;

var
  s1: AnsiString;
  s2: string;
begin
  s1 := 's1';
  WriteLn('s1 = ', s1, ' : ', SizeOf(s1));
  s2 := 's2';
  WriteLn('s2 = ', s2, ' : ', SizeOf(s2));

end.
==================
TEST RUN 1
Command-line: fpc -Mobjfpc test_string.pas
Output:
s1 = s1 : 4
s2 = s2 : 256
==================
TEST RUN 2
Command-line: fpc -Mobjfpc -Sh test_string.pas
Output:
s1 = s1 : 4
s2 = s2 : 4
==================
TEST RUN 3
Command-line: fpc -Sh -Mobjfpc test_string.pas
Output:
s1 = s1 : 4
s2 = s2 : 256
==================

As you can see, in the third case string is interpreted as ShortString, not AnsiString. Is this intended behaviour of compiler, or command-line processing bug?

Best,
Aleksa

Reply by email

Michael Van Canneyt
to Aleksa Todorovic
Aleksa Todorovic wrote 6 lines
Hi! As you can see, in the third case string is interpreted as ShortString, not AnsiString. Is this intended behaviour of compiler, or command-line processing bug?

This is intended behaviour.
The Mode switch resets some other switches.

Lazarus should generate the mode switch in the first position.

Michael.

Reply by email

Aleksa Todorovic
to Michael Van Canneyt

Thanks for the quick reply, I'll make bug-report immediately.

Michael Van Canneyt wrote 21 lines
On Mon, 22 Sep 2008, Aleksa Todorovic wrote: > Hi! > > > As you can see, in the third case string is interpreted as > ShortString, not AnsiString. Is this intended behaviour of compiler, > or command-line processing bug? This is intended behaviour. The Mode switch resets some other switches. Lazarus should generate the mode switch in the first position. Michael. _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email