Home » U++ Library support » U++ Core » Deprecating THISBACK (Post 2020.2 release)
Deprecating THISBACK [message #55122] |
Mon, 12 October 2020 22:31  |
 |
Klugier
Messages: 1099 Registered: September 2012 Location: Poland, Kraków
|
Senior Contributor |
|
|
Hello,
I had the discussion with Mirek about this article https://evileg.com/en/post/629/ he found that the user uses deprecated THISBACK construction. Well we deprecated it in the documentation in favor or lambdas or newer c++ constructions such as Function, Gate etc.
In c++14 which we targets on all platforms the solution is easy. We can deprecate it on compilation level, which means something. Just mark THISBACK with deprecated atribute like this:
[[deprecated("THISBACK is deprecated use lambda instead.")]]
const int thisbackd = 0;
#define THISBACK(x) callback(this + thisbackd, &CLASSNAME::x)
#define THISBACK1(x, arg) callback1(this + thisbackd, &CLASSNAME::x, arg)
#define THISBACK2(m, a, b) callback2(this + thisbackd, &CLASSNAME::m, a, b)
#define THISBACK3(m, a, b, c) callback3(this + thisbackd, &CLASSNAME::m, a, b, c)
#define THISBACK4(m, a, b, c, d) callback4(this + thisbackd, &CLASSNAME::m, a, b, c, d)
#define THISBACK5(m, a, b, c, d, e) callback5(this + thisbackd, &CLASSNAME::m, a, b, c, d,e)
Then in all places when THISBACK is used the warning pop up "/home/klugier/upp/uppsrc/CtrlLib/FileSel.h (239): warning: 'thisbackd' is deprecated: THISBACK is deprecated use lambda instead. [-Wdeprecated-declarations]".
If you are not aware how you should replace thisback. Example below:
void MyWidnow::ErrorMenu(Bar& bar)
// bar.Add("Copy all", THISBACK1(CopyError, true));
bar.Add("Copy all", [=] { CopyError(true); });
// In the header file no need for "typedef MyWindow CLASSNAME" declaration...
I think we have multiple places when [[deprecated]] macro can be used. If you search for "deprecated" in uppsrc then there is around 52 entries... Definitely not the topic for 2020.2, but for 2021.1...
Klugier
U++ - one framework to rule them all.
[Updated on: Tue, 13 October 2020 11:29] Report message to a moderator
|
|
|
 |
|
Deprecating THISBACK
By: Klugier on Mon, 12 October 2020 22:31
|
 |
|
Re: Deprecating THISBACK
By: mirek on Mon, 12 October 2020 23:25
|
 |
|
Re: Deprecating THISBACK
By: Klugier on Tue, 13 October 2020 00:28
|
 |
|
Re: Deprecating THISBACK
By: mirek on Tue, 13 October 2020 00:36
|
 |
|
Re: Deprecating THISBACK
By: Klugier on Thu, 15 October 2020 00:10
|
 |
|
Re: Deprecating THISBACK
By: mirek on Thu, 15 October 2020 01:01
|
 |
|
Re: Deprecating THISBACK
By: Oblivion on Thu, 15 October 2020 01:14
|
 |
|
Re: Deprecating THISBACK
By: Klugier on Sun, 15 November 2020 00:44
|
 |
|
Re: Deprecating THISBACK
By: mirek on Sun, 15 November 2020 00:58
|
 |
|
Re: Deprecating THISBACK
By: mirek on Sun, 15 November 2020 01:42
|
 |
|
Re: Deprecating THISBACK
By: Lance on Mon, 16 November 2020 00:58
|
 |
|
Re: Deprecating THISBACK
By: Klugier on Mon, 16 November 2020 23:37
|
 |
 |
Re: Deprecating THISBACK
|
 |
|
Re: Deprecating THISBACK
By: mirek on Sun, 23 May 2021 13:17
|
 |
|
Re: Deprecating THISBACK
|
 |
|
Re: Deprecating THISBACK
By: Klugier on Sun, 23 May 2021 14:46
|
 |
|
Re: Deprecating THISBACK
|
Goto Forum:
Current Time: Sat May 10 07:13:19 CEST 2025
Total time taken to generate the page: 0.01052 seconds
|