[Development] QUIP 6: removing top-level const from return types
apoenitz at t-online.de
Mon May 22 20:14:01 CEST 2017
On Mon, May 22, 2017 at 04:14:59PM +0200, Olivier Goffart wrote:
> Am Montag, 22. Mai 2017, 12:04:10 CEST schrieb Marc Mutz:
> > Hi,
> > Removing top-level const from return types is a QUIP-6 Cat-A SiC, but was
> > missing from the examples.
> > https://codereview.qt-project.org/195285 proposes to add it to the QUIP.
> > Precedence: E.g. https://codereview.qt-project.org/93161
> I think it's fine to break SiC in this case.
> Maybe we can have a QT_RETURNED_CONST_TYPE macro that would be defined to
> "const" iff Q_COMPILER_MANGLES_RETURN_TYPE is defined, or nothing otherwise.
> That way one would just write:
> QT_RETURNED_CONST_TYPE QPixmap pixmap() const;
> and we would avoid any #ifdef
That would be sensible and at least would remove part of the cosmetical
atrocity this patch introduces.
Note, however, that it was not this change that caused the current
controversy, but https://codereview.qt-project.org/#/c/195229/ i.e.
-const QPixmap QSplashScreen::pixmap() const
+#if !defined(Q_QDOC) && defined(Q_COMPILER_MANGLES_RETURN_TYPE) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
++QPixmap QSplashScreen::pixmap() const
This introduces three lines of compiler-dependent #ifdef-ery
- in a rarely used function
- in a not-exactly-widely-used class
- for absolutely no user-visible gain.
I do not want the Qt code base develop into a direction where common
activities like "declaring a trivial getter" are hidden behind a
Jmulti-line preprocessor mess.
If *that* code style is considered acceptable we do have a serious
More information about the Development