[Development] On deprecating functions

Tor Arne Vestbø Tor.arne.Vestbo at qt.io
Tue Mar 5 11:53:28 CET 2019



> On 5 Mar 2019, at 11:27, Giuseppe D'Angelo via Development <development at qt-project.org> wrote:
> 
> Il 05/03/19 08:14, Lars Knoll ha scritto:
>> One solution I thought about is to replace the QT_DEPRECATED(_X) macros with something that also contains the version (similar to QT_DEPRECATED_SINCE). Then the user could define how current he wants to be, and we could set a reasonable default going e.g. one LTS back.
> 
> I'd go with this one. Should make everyone happy. Can anyone see any adverse effect?

I also prefer this one. This is also how Apple tags their functions, eg:

- (void)cacheImageInRect:(NSRect)rect NS_DEPRECATED_MAC(10_0, 10_13, "This method shouldn’t be used as it doesn’t work in all drawing situations; instead, a subview should be used that implements the desired drawing behavior");

The first argument is when the function was introduced, and the second argument when it was deprecated.

They also use a special soft deprecation version named API_TO_BE_DEPRECATED that’s just a very high version number. 

See https://asciiwwdc.com/2018/sessions/209 for a discussion about this, and these headers:

https://gist.github.com/torarnv/5f76f09a46ccc94e034fdec62b855e9e

https://raw.githubusercontent.com/phracker/MacOSX-SDKs/master/MacOSX10.13.sdk/usr/include/AvailabilityInternal.h

Tor Arne 


More information about the Development mailing list