[xsd-users] Feature request: Explicit constructors

Benjamin Schindler bschindler at inf.ethz.ch
Thu Nov 18 17:03:12 EST 2010


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

Cheers
Benjamin


On 18.11.2010 14:52, Ray Lischner wrote:
> Benjamin Schindler <bschindler at inf.ethz.ch> writes:
> 
>> I just stumbled across a problem with explicit conversions. I have a
>> class with 2 constructors:
>>
>> MyClass(FrameKind, double)
>> MyClass(const std::string&, double)
>> ...
> 
> The implicit string constructors are extremely useful. I would resolve the ambiguity by adding a constructor to MyClass:
> 
> MyClass(char const*, double)
> 
> 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