Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Solving the "constructor" problem in C++

Author: Paul Byrne

Date: 21:15:11 06/13/02

Go up one level in this thread


On June 12, 2002 at 15:49:36, Russell Reagan wrote:

>On June 12, 2002 at 15:40:15, Oliver Roese wrote:
>
>>Simply make sure your constructor is empty and your class has
>>no virtual functions. The compiler will then optimize the call away.
>>I had the same problem recently and this solution worked with gcc.
>
>Someone else said the opposite was true for MS VC++ (which is what I'm using).
>Here's the link: http://www.talkchess.com/forums/1/message.html?234679
>
>He said that MS VC++ will sit in a loop initializing all of the objects in an
>array, even if the constructor is empty. I wonder if maybe he was getting this
>result in DEBUG mode maybe? He didn't say when I asked him, so who knows. Maybe
>MS VC++ does optimize this away in RELEASE mode, which would be problem solved
>:) You'd think surely a compiler as popular as MS VC++ would handle a seemingly
>trivial optimization like this, but once upon a time there was Windows 95 too...
>
>Russell

That was me... sorry for the non-response.  I'm still recovering from a hard
drive crash.

It was definitely done in release mode.

-paul



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.