[MOAB-dev] Discussion on return type of MOAB routines

Wu, Danqing wuda at mcs.anl.gov
Wed Jan 22 09:59:23 CST 2014


The object contains an enum type ErrorCode and std::string. The size of this object is fixed, like 16 bytes in my test. However, std::string is essential like a wrapped pointer implemented by STL. Here I think the "size" Tim mentions is related to the length of the string, which will affect the performance of the copy constructor of std::string, when this object is returned by value from MOAB routines.
________________________________________
From: Jed Brown [jed at jedbrown.org]
Sent: Tuesday, January 21, 2014 11:58 AM
To: Tautges, Timothy J.; Vijay S. Mahadevan; Wu, Danqing
Cc: moab-dev at mcs.anl.gov
Subject: Re: [MOAB-dev] Discussion on return type of MOAB routines

"Tim Tautges (ANL)" <tautges at mcs.anl.gov> writes:
> Finally, as I've said before, the size of these objects being returned will be small except in non-success conditions,

What does this mean?  The caller has to know the size of the object
being returned.  It looks like you are returning objects rather than
pointers, so the object has to be completely defined.  It could contain
pointers to "more", but then that "more" would have to be allocated
somewhere on the heap so that it is accessible from parent scopes.


More information about the moab-dev mailing list