[fpc-devel] Need patch for bugs : 0011503 / 0009472

Boian Mitov mitov at mitov.com
Thu Jun 19 15:37:13 CEST 2008


  Hi Marco,

You are wrong. They mean expression not block!
This is one block with 3 expressions:

{
  a = 3 + 4;
  b = 5 + 3;
  c =  3 + 7;
}

If an temporary variable is created it must be destroyed before the ";" 
symbol, not at the end of the block!
This is vary good as it prevent any "optimization" to break your code ;-) . 
You know exactly where the destructor will be called on any ANSI C++ 
compiler in the world. This is the reason C++ remains my favorite language 
regardless of the many issues it has. It is 100% defined, and you know 100% 
what it will do ;-) .

  With best regards,
    Boian Mitov

--------------------------------------------------------------------
Mitov Software
http://www.mitov.com
--------------------------------------------------------------------


----- Original Message ----- 
From: "Marco van de Voort" <marcov at stack.nl>
To: "FPC developers' list" <fpc-devel at lists.freepascal.org>
Sent: Thursday, June 19, 2008 6:31 AM
Subject: Re: [fpc-devel] Need patch for bugs : 0011503 / 0009472


>> Page 244
>> Item 3 describes the lifespan of a temporary object in expression (rvalue
>> life span):
>
> Ah, but this is a compiler generated object as result value. I'm still
> surprised btw that they omit this possible optimization (e.g. destruction
> with the frame), but that is probably related with the need to have the
> compiler always honor nested { } blocks.
>
> Anyway, that is something else then a explicitely declared interface
> reference as we have here, so one needs a different example.
>
> What comes close to an interface in behaviour in C++, smart pointers?
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel 




More information about the fpc-devel mailing list