Sign in Join

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

Mailing lists / fpc-devel / 2010-12

variant type - crash question

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Martin

Never used variants much.

But the below compiles, and then gives a SigSegV (w32). Is that to be expected? Or ?

program Project1;
{$mode objfpc}{$H+}
uses
   Classes;
procedure Foo(v1,v2: Variant; constref v3,v4: Variant);
begin
writeln(v1,v2,v3,v4);
end;
begin
   Foo(1,'a',2,'bc');  // <<<<<<< Fails in this line
end.

Reply by email

Sergei Gorelkin
to Martin

Martin пишет:

Show quoted text 19 lines
Never used variants much. But the below compiles, and then gives a SigSegV (w32). Is that to be expected? Or ? program Project1; {$mode objfpc}{$H+} uses Classes; procedure Foo(v1,v2: Variant; constref v3,v4: Variant); begin writeln(v1,v2,v3,v4); end; begin Foo(1,'a',2,'bc'); // <<<<<<< Fails in this line end.

If you add unit Variants to uses clause, the bug is gone.

The compiler is known to add unit Variants automatically (and issue a warning when it does so). Strange thing is that it doesn't happen in this particular case.

Sergei

Reply by email

Florian Klaempfl
to Sergei Gorelkin
Sergei Gorelkin wrote 25 lines
Martin пишет: > Never used variants much. > > But the below compiles, and then gives a SigSegV (w32). > Is that to be expected? Or ? > > program Project1; > {$mode objfpc}{$H+} > uses > Classes; > > procedure Foo(v1,v2: Variant; constref v3,v4: Variant); > begin > writeln(v1,v2,v3,v4); > end; > > begin > Foo(1,'a',2,'bc'); // <<<<<<< Fails in this line > end. > If you add unit Variants to uses clause, the bug is gone. The compiler is known to add unit Variants automatically (and issue a warning when it does so). Strange thing is that it doesn't happen in this particular case.

This is because no variable of the type variant is declared.

Reply by email