[asterisk-scf-dev] Changes regarding state replicator keys

Brent Eagles beagles at digium.com
Tue Dec 14 18:23:10 UTC 2010


On Tue, Dec 14, 2010 at 11:22:24AM -0600, Mark Michelson wrote:

<snip>

> > You could add the 'operator char[]' conversion as a non-member
> > function, and the compiler will use it if it's in scope of the unit
> > being compiled. But... conversion functions that allow for implicit
> > conversions are sort of evil anyway. However, C++0x has support for
> > explicit conversion functions. Here's an article that describes the
> > newer syntax: http://www.devx.com/cplus/10MinuteSolution/39438/1954
> >
> > That article is talking about member functions, but it should work
> > for non-member functions as well. (At least, I don't see why it
> > wouldn't!) Anyway, more to think about.
> >    
> Yep, after wondering why there was no implicit char[] conversion in 
> std::string, I searched and found that the explanation most often given 
> was the inherent "evilness" of implicit conversion operators. That's why 
> they have the .c_str() function instead. Of course that sucks when the 
> type is a template.

People love implicit conversion operators until they have to
troubleshoot something without a debugger that should be doing x, when
it appears to be doing y, or z is happening for no apparent reason.

In contrast, Microsoft's frameworks are full of conversion operators :)

Cheers,

Brent



More information about the asterisk-scf-dev mailing list