usage of KDE_DEPRECATED

Nicolas Goutte nicolasg at snafu.de
Wed Mar 1 11:18:23 GMT 2006


On Wednesday 01 March 2006 12:02, Nicolas Goutte wrote:
> On Wednesday 01 March 2006 11:52, Thiago Macieira wrote:
> > Nicolas Goutte wrote:
> > >On Wednesday 01 March 2006 10:44, Luciano Montanaro wrote:
> > >> On Wednesday 01 March 2006 07:46, Christian Ehrlicher wrote:
> > >> > Hi,
> > >> >
> > >> > Can someone tell me why I need to place KDE_DEPRECATED behind the
> > >> > deprecated function and why it won't work when it's written before?
> > >> > Qt's deprecated-macro is placed before the function and works fine.
> > >> > The problem is that msvc only allows it in front of the function and
> > >> > therefore we can't use KDE_DEPRECATED for msvc...
> > >>
> > >> KDE_DEPRECATED expands to __attribute__((deprecated)) with gcc, which
> > >> should be put after the function declaration to work. I think this
> > >> limitation has been lifted for newer gcc versions, so maybe it can be
> > >> put before the function declaration as for the inline function.
> > >
> > >If you do so, then check the gcc version and disable it for older gcc
> > >versions, a gcc 3.3.1 does not allow it.
> >
> > #define KDE_DEPRECATED Q_DECL_DEPRECATED
> >
> > and always use it in the before position. That macro already does the gcc
> > 3.3 checking.
> >
> > If your compiler doesn't support that, you can't build Qt4 anyways, so
> > it's not a problem.
>
> Then why does KDE not use Q_DECL_DEPRECATED directly (apart of historical
> reasons)?

Thinking further, may be your way is better, in the case that in Qt5 or later, 
the macro would be renamed in Qt.

>
> Have a nice day!





More information about the kde-core-devel mailing list