Re: [Development] Fw: How to do deprecation

2022-07-21 Thread Edward Welbourne
Lars wrote:
>> So instead of
>>
>> #if QT_DEPRECATED_SINCE(6, 4)
>> QT_DEPRECATED_VERSION_X_6_4("Use size() or length() instead.")
>> inline qsizetype count() const { return d.size; }
>> #endif
>>
>> You’d have:
>>
>> QT_DEPRECATED_METHOD(qsizetype count(), 6, 4, "Use size() or length() 
>> instead.”)

Jaroslaw Kobus (21 July 2022 09:51) replied:
> it would be really cool to have it like this. However, just joining
> QT_DEPRECATED_SINCE with QT_DEPRECATED_VERSION_X_Y_Z would also be a
> small and simple step forward.

The thing is, the only way to do that is indeed to do it in the form of
a macro such as Lars described, since the results of preprocessing must
be capable of producing:
* No declaration at all
* The declaration with a [[deprecated]] marker
* The plain declaration

and the C preprocessor is very simple in its capabilities.  In
particular, you can't cause the #if-ery round some code to define a
scope in which all declarations are automagically preceded with a
deprecation marker, so you can't get away from needing a macro applied
to each of the declarations; and that can't vanish entirely unless every
part of the declaration is packaged in its parameters (since anything
outside its parameter list will still be seen by the compiler), unless
you separately wrap it in #if-ery.  So what Lars proposes is the only
way to unify the two present intrusions into code.

Eddy.
___
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development


[Development] Fw: How to do deprecation

2022-07-21 Thread Jaroslaw Kobus
"So instead of

#if QT_DEPRECATED_SINCE(6, 4)

QT_DEPRECATED_VERSION_X_6_4("Use size() or length() instead.")

inline qsizetype count() const { return d.size; }

#endif

You’d have:

QT_DEPRECATED_METHOD(qsizetype count(), 6, 4, "Use size() or length() 
instead.”)
"

Hi,

it would be really cool to have it like this. However, just joining 
QT_DEPRECATED_SINCE with QT_DEPRECATED_VERSION_X_Y_Z would also be a small and 
simple step forward.

Jarek



___
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development