KDE/kdebase/kicker/kicker

Alexander Neundorf neundorf at kde.org
Wed Jan 4 18:12:12 GMT 2006


Hi,

On Wednesday 04 January 2006 18:44, Alexander Neundorf wrote:
...
> And here's already another one:

And another one:
--- konq_mainwindow.cc  (revision 493979)
+++ konq_mainwindow.cc  (working copy)
@@ -1411,7 +1411,7 @@
   // Don't pre-fill the url, as it is auto-selected and thus overwrites the
   // X clipboard, making it impossible to paste in the url you really wanted.
   // Another example of why the X clipboard sux
-  KURLRequesterDlg dlg( QString(), this, 0, true);
+   KURLRequesterDlg dlg( QString::null, this, 0, true);
   dlg.setCaption( i18n("Open Location") );

And this is the typical error message, this time from konq_mainwindow.cc:

/home/src/my_stuff/kde4-svn/kdebase/konqueror/konq_mainwindow.cc: In member
   function `void KonqMainWindow::slotOpenLocation()':
/home/src/my_stuff/kde4-svn/kdebase/konqueror/konq_mainwindow.cc:1414: type
   specifier omitted for parameter
/home/src/my_stuff/kde4-svn/kdebase/konqueror/konq_mainwindow.cc:1414: syntax
   error before `this'
/home/src/my_stuff/kde4-svn/kdebase/konqueror/konq_mainwindow.cc:1415: request
   for member `setCaption' in `dlg(...)', which is of non-aggregate type `
   KURLRequesterDlg ()(...)'
/home/src/my_stuff/kde4-svn/kdebase/konqueror/konq_mainwindow.cc:1421: request
   for member `urlRequester' in `dlg(...)', which is of non-aggregate type `
   KURLRequesterDlg ()(...)'

Quote from David Faure:

> This is a known parsing ambiguity in C++.
>
> As the book "Effective STL" says in item 6:
>
> int g(double (*pf)(); // g takes a pointer to a function as parameter
> int g(double pf()); // same as above; pf is implicitly a pointer
> int g(double()); // same as above; parameter name is ommitted
>
> Replace double with QString, and you'll see that SomeClass dlg(QString())
> can be parsed both ways.
>
> The book doesn't mention a good solution to this other than naming the
> anonymous object, i.e. QString empty; SomeClass dlg(empty); which is ugly.
> Using QString::null is cleaner IMHO, especially since QString::null is part 
> of Qt4 proper, it's not a QT3_SUPPORT thing. It's just a tiny bit slower to
> convert to a QString, but when we're talking about creating a dialog that's 
> fine

Alex
-- 
Work: alexander.neundorf at jenoptik.com - http://www.jenoptik-los.de
Home: neundorf at kde.org                - http://www.kde.org
      alex at neundorf.net               - http://www.neundorf.net




More information about the kde-core-devel mailing list