Re: access canvas created

From: Andriy Zatserklyaniy <zatserkl_at_gmail.com>
Date: Fri, 19 Aug 2011 10:11:03 -0700


OK, seems no difference __with operator new__, both forms are correct:

new TCanvas;
new TCanvas();

See http://stackoverflow.com/questions/620137/do-the-parentheses-after-the-type-name-make-a-difference-with-new

Cheers,
Andrei.

On Fri, Aug 19, 2011 at 9:32 AM, Andriy Zatserklyaniy <zatserkl_at_gmail.com> wrote:
> Hi Benjamin,
>
> See link http://yosefk.com/c++fqa/ctors.html, "[10.2] Is there any
> difference between List x; and List x();?"
> Syntax
>
> TCanvas canvas();
>
> is incorrect and create mistake which hard to figure out, one should use
>
> TCanvas canvas;
>
> instead.
>
> Cheers,
> Andrei.
>
> On Fri, Aug 19, 2011 at 8:45 AM, Benjamin Bannier <bbannier_at_gmail.com> wrote:
>> Hi Andriy,
>>
>>> BTW, a correct syntax to create new object of TCanvas is (NB: no
>>> parenthesis!)
>>
>> Could you explain your reasoning? I thought if possible one would rather
>> have the TCanvas value-initialized instead of default-initialized.
>>
>> Benjamin
>>
>> [1]: http://stackoverflow.com/questions/620137/do-the-parentheses-after-the-type-name-make-a-difference-with-new/620402#620402
>> [2]: http://stackoverflow.com/questions/5610629/difference-between-default-initialize-and-value-initialize/5610655#5610655
>>
>
Received on Fri Aug 19 2011 - 19:11:32 CEST

This archive was generated by hypermail 2.2.0 : Sun Aug 21 2011 - 05:50:01 CEST