Bug #32669 ndb-connectors rely on not yet standard map::at() method
Submitted: 23 Nov 2007 16:56 Modified: 23 Nov 2007 21:16
Reporter: Hartmut Holzgraefe Email Updates:
Status: Closed Impact on me:
None 
Category:Connectors: NDB/Bindings Severity:S2 (Serious)
Version:ndb-connectors-0.5.6.3.5.2 OS:Linux
Assigned to: Monty Taylor CPU Architecture:Any

[23 Nov 2007 16:56] Hartmut Holzgraefe
Description:
Compiling the java part of ndb-connectors fails with gcc < 4.1.x
as the code relies on the presence of the at() method on std::map

As far as i understand this method is a proposed addition 
to the next iteration of the standard but not part of it
in any released version yet.

See http://gcc.gnu.org/onlinedocs/libstdc++/ext/lwg-defects.html#464
and http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP

So this is a major portability issue that will most likely 
also affect non-gcc platforms and users of non-gnu STL 
implementations.

How to repeat:
Compile ndb-connectors on GCC 4.0 or older using the STL library that comes with it:

mgmj.cxx: In member function 'int NdbLogEventManager::registerCategoryListener(NdbLogEventCategoryListener*)':
mgmj.cxx:1470: error: 'class std::map<ndb_mgm_event_category, NdbLogEventCategoryListener*, std::less<ndb_mgm_event_category>, std::allocator<std::pair<const ndb_mgm_event_category, NdbLogEventCategoryListener*> > >' has no member named 'at'
mgmj.cxx: In member function 'BaseEventWrapper* NdbLogEventManager::getLogEvent(unsigned int)':
mgmj.cxx:1507: error: 'class std::map<Ndb_logevent_type, NdbLogEventTypeListener*, std::less<Ndb_logevent_type>, std::allocator<std::pair<const Ndb_logevent_type, NdbLogEventTypeListener*> > >' has no member named 'at'
mgmj.cxx:1516: error: 'class std::map<ndb_mgm_event_category, NdbLogEventCategoryListener*, std::less<ndb_mgm_event_category>, std::allocator<std::pair<const ndb_mgm_event_category, NdbLogEventCategoryListener*> > >' has no member named 'at'
make[3]: *** [libmgmj_la-mgmj.lo] Error 1

Suggested fix:
Do not use non-standard methods
[23 Nov 2007 19:16] Monty Taylor
Ah yes. I agree, this should go away. The nice side effect to fixing this bit of code is that I get to get rid of the use of C++ exceptions, too.
[23 Nov 2007 20:18] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/38401
[23 Nov 2007 20:41] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/38403
[23 Nov 2007 21:16] Monty Taylor
Fixed pushed in ndb-connectors-0.5.6.3.5.3