[xsd-users] Feature request: Explicit constructors

Ray Lischner rlischner at proteuseng.com
Fri Nov 19 07:59:35 EST 2010


Benjamin Schindler <bschindler at inf.ethz.ch> writes:
> In C++, implicit type conversions are usually not recommended due to the
> difficult predictability of performance. Using explicit as much as
> possible is recommended, see i.e.
> http://www.doc.ic.ac.uk/lab/cplus/c++.rules/chap13.html

> I know they are useful - but they are only useful until you get hit by a
> type conversion you didn't expect causing weird bugs, at which point you
> usually stop using them for 99% percent of the code. For a generic
> library such as xsd doubly so

The MyClass constructors that are already defined rely on implicit construction of std::string from char const*.
My recommendation is to add a constructor to bypass that implicit construction and to be explicit about the construction of MyClass from char const*.

Ray Lischner,
Senior Member of Technical Staff
133 National Business Pkwy, Ste 150     t. 443.539.3448
Annapolis Junction, MD 20701                c. 410.854.5170
rlischner at proteuseng.com                     f. 443.539.3370

This electronic message and any files transmitted with it contain information
which may be privileged and/or proprietary. The information is intended for use
solely by the intended recipient(s). If you are not the intended recipient, be
aware that any disclosure, copying, distribution or use of this information is
prohibited. If you have received this electronic message in error, please advise
the sender by reply email or by telephone (443.539.3400) and delete the message.



More information about the xsd-users mailing list