[fdo-users] ArcSDE: Another serious bug (general C++ trap)

Greg Boone greg.boone at autodesk.com
Mon Feb 28 11:07:29 EST 2011


Hi Oyvind,

Please log a Trac ticket and attach a patch with your recommended changes.

Regards,
Greg

From: fdo-users-bounces at lists.osgeo.org [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of Traian Stanev
Sent: Monday, February 28, 2011 10:59 AM
To: 'FDO Users Mail List'
Subject: RE: [fdo-users] ArcSDE: Another serious bug (general C++ trap)


In fact, in C++ it will not initialize the object, unlike e.g. Java.

As the poster said, it will construct an ArcSDEFilterToSQL in the local scope and then return, with the object the caller wanted to initialize being left uninitialized. It's a serious bug if that constructor is ever used.

Traian


From: fdo-users-bounces at lists.osgeo.org [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of Greg Boone
Sent: Monday, February 28, 2011 10:27 AM
To: FDO Users Mail List
Subject: RE: [fdo-users] ArcSDE: Another serious bug (general C++ trap)

This looks like a good area for refactoring. I agree that having the default constructor call the non-default constructor is not the best approach.

Greg

From: fdo-users-bounces at lists.osgeo.org [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of Oyvind Idland
Sent: Monday, February 28, 2011 7:41 AM
To: FDO Users Mail List
Subject: [fdo-users] ArcSDE: Another serious bug (general C++ trap)

In the definition of ArcSDEFilterToSql  (in ArcSDEFilterToSQL.h), there are two
constructors:

    ArcSDEFilterToSql() { ArcSDEFilterToSql(NULL, NULL); }  // 0-argument constructor to please FdoPtr::operator->

    ArcSDEFilterToSql (ArcSDEConnection *conn, FdoClassDefinition* definition);


The first one with no arguments will not work, in fact, it will just allocate another instance of itself and return.

There is, as far as I know, no way to make a constructor call another constructor in C++. Instead, an init() method
must be implemented.

I don't know if this constructor has ever been used, I just saw it while refactoring code.. but I am a bit worried if
this has been done several places.


-- Oyvind


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/fdo-users/attachments/20110228/a8f48cb4/attachment-0001.html


More information about the fdo-users mailing list