[PATCH]: KURLDrag::decode() and the use of explicit

André Wöbbeking Woebbeking at onlinehome.de
Tue Jul 22 16:59:46 BST 2003


On Tuesday 22 July 2003 01:12, Dawit A. wrote:
> On Monday 21 July 2003 06:09, André Wöbbeking wrote:
> > On Monday 21 July 2003 10:29, Waldo Bastian wrote:
> > > On Saturday 19 July 2003 10:14, André Wöbbeking wrote:
> > >
> > > I think adding explicit would break source compatibility. Other
> > > than I think it's a good idea to add it (locally) to see what
> > > breaks and convert all code in CVS to use explicit casts.
> >
> > Can we add explicit before KDE 4.0? And if so it should be done for
> > all of kdelibs (at least).
>
> Just playing the devil's advocate... Why would one do KURL (42) again
> ? Were you simply making a hypothetical point ? If we are going to

No, you can do this by accident. Think of a method which takes a KURL as 
parameter but unfortunately you take a variable of type int as 
parameter instead of a variable of type QString. 

And KURL(42) is equivalent to KURL(QCString(42)) which is equivalent to 
KURL(QCString()).

> add explicit ctors, are we going to do it for all the other data
> types as well ? IMHO, it should be the responsibility of the
> programmer to doing something like
>
> KURL (QString::number(42))
>
> There is no need to make KURL more bloated than it already is just to
> accommodate a few corner cases...  Just my 2 cents FWIW.

Oh, I think you misunderstood me. I mean the use of the C++ keyword 
"explicit" :-)


André




More information about the kde-core-devel mailing list