Victor Bazarov
10/13/2008 4:44:00 PM
martyn_dobson@hotmail.com wrote:
> yeah the standard thing is to have to call s.c_str().
> the standards board purposefully didnt put an operator char* into
> string for the reason that you cant make the std::string class act
> entirely like a pod type like in other languages because of variable
> arguments.
>
> i meant this only as a possible conversion for a class beign passed
> into a variable argument parameter list. its one of those things that
> catches people out, and makes other programmers wonder why c++ isnt
> more helpfull some times.
>
> just thought it could be a handy little addition.
The problem with "handy little" additions like that is that they aren't
as little as you might think. It's not always easy to find the right
balance, it seems. If you only say that 'operator...' is used where the
object is passed to the function with variable number of arguments, then
the usefulness of that addition is really questionable. If you try to
extend the scope of the change to, say, include any possible conversion
that is not otherwise explicitly specified, then all the potential areas
that the change is going to affect suddenly become hard to enumerate.
I would say that at this point on C++ development as a language, it is
unlikely that such a narrowly scoped addition is going to be adopted.
OTOH, it would be nice, perhaps, to amend the language to actually
specify what conversion is going to be used when an object or a
reference to an object is passed to the function with ellipsis, instead
of just saying essentially nothing (by hiding behind UB excuse).
Post to comp.lang.c++.moderated (and write it up a bit more
specifically), see what reaction you get. Some folks do not read the
non-moderated forum (why, beats me), and you might actually want their
input.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask