Re: Noteworthy changes when porting to C++17

2021-07-22 Thread Frederik Schwarzer




On 7/19/21 5:52 PM, David Faure wrote:

On dimanche 18 juillet 2021 02:34:24 CEST Frederik Schwarzer wrote:

So the question is: did you notice things that have been removed from
the C++ standard since C++11 that were used in our applications?


I found a list of things that were removed from C++11 in C++17:

http://www.cplusplus2017.info/removed-features-from-c17/

Maybe you can simply link to this document?


Thanks for the link. :)

Yes, it was my plan to link to such kind of information but I was also 
thinking of going into a bit more detail on one or two of those in case 
they were quite common in KDE land. But apparently this is not the case.


Cheers,
Frederik


Re: Noteworthy changes when porting to C++17

2021-07-19 Thread David Faure
On dimanche 18 juillet 2021 02:34:24 CEST Frederik Schwarzer wrote:
> So the question is: did you notice things that have been removed from
> the C++ standard since C++11 that were used in our applications?

I found a list of things that were removed from C++11 in C++17:

http://www.cplusplus2017.info/removed-features-from-c17/

Maybe you can simply link to this document?

-- 
David Faure, fa...@kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5





Re: Noteworthy changes when porting to C++17

2021-07-19 Thread Ivan Čukić
> > What I have seen is that std::mem_fun was used within KIO and has been
> > replaced by std::mem_fn. Not sure if that counts as "commonly used",
> > though.

> Imo, usages of either of these two should be rewritten to use lambdas
> instead.

-1

Member function pointers are more readable than lambdas in cases
where they can be used (std::ranges). Sadly, mem_fn is a syntactic noise
meant as an excuse why some things don't accept all invokables/callables
but only function objects. But, while it is uglier than just a pointer to a 
member function, I still find it more readable then lambdas. And it is 
optimized out by good compilers (tested on gcc 10) just as lambdas are.

std::ranges::all_of(vs, _t::check);

versus

std::all_of(..., std::mem_fn(_t::check));

versus

std::all_of(..., [] (const some_t& t) {
return t.check();
});

Cheers,
Ivan

-- 
dr Ivan Čukić
i...@cukic.co, https://cukic.co/
gpg key fingerprint: 8FE4 D32F 7061 EA9C 8232  07AE 01C6 CE2B FF04 1C12





Re: Noteworthy changes when porting to C++17

2021-07-18 Thread Milian Wolff
On Sonntag, 18. Juli 2021 02:34:24 CEST Frederik Schwarzer wrote:
> Hi,
> 
> since we are increasing the C++ standard requirement from 11 to 17 with
> KF6 and there were a few deprecations/removals in between, I wonder if
> any of those are noteworthy for people developing applications based on
> KDE Frameworks.
> 
> What I mean by "noteworthy" is features that are commonly used or at
> least known to be used sometimes in our ecosystem. Things like the
> "register" keyword for example might not be found in high-level
> applications so pointing KDE developers to its removal might get you
> shrugs in return.
> 
> What I have seen is that std::mem_fun was used within KIO and has been
> replaced by std::mem_fn. Not sure if that counts as "commonly used", though.

Imo, usages of either of these two should be rewritten to use lambdas instead.

> Compiler vendors seem to be handling those removalss differently. The
> libstdc++ devs have not had deprecation warnings for at least some of
> the stuff that was deprecated in C++11, so they will not remove those
> any time soon. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91383#c1
> 
> In libc++, the deprecation warnings were shown since C++11 and now with
> C++17 they removed some stuff. On Linux you will have to build with the
> -stdlib=libc++ option for clang to notice. See e.g.
> https://godbolt.org/z/6Y1eE3z4P for playing with it.
> 
> But I digress ...
> 
> So the question is: did you notice things that have been removed from
> the C++ standard since C++11 that were used in our applications?


-- 
Milian Wolff
m...@milianw.de
http://milianw.de

signature.asc
Description: This is a digitally signed message part.


Re: Noteworthy changes when porting to C++17

2021-07-18 Thread Frederik Schwarzer

Hi,

Thanks for the links. I know about those papers but I do not think we 
should point KF6 application porters there because the vast majority of 
the stuff mentioned is very unlikely to affect them.


For now I will go with some general remarks here.

Cheers,
Frederik

On 7/18/21 10:22 AM, David Redondo wrote:

Hi I found these two papers

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1319r0.html
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0636r1.html

Regards,
David




Re: Noteworthy changes when porting to C++17

2021-07-18 Thread David Redondo
Hi I found these two papers

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1319r0.html
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0636r1.html

Regards,
David




Noteworthy changes when porting to C++17

2021-07-17 Thread Frederik Schwarzer

Hi,

since we are increasing the C++ standard requirement from 11 to 17 with 
KF6 and there were a few deprecations/removals in between, I wonder if 
any of those are noteworthy for people developing applications based on 
KDE Frameworks.


What I mean by "noteworthy" is features that are commonly used or at 
least known to be used sometimes in our ecosystem. Things like the 
"register" keyword for example might not be found in high-level 
applications so pointing KDE developers to its removal might get you 
shrugs in return.


What I have seen is that std::mem_fun was used within KIO and has been 
replaced by std::mem_fn. Not sure if that counts as "commonly used", though.


Compiler vendors seem to be handling those removalss differently. The 
libstdc++ devs have not had deprecation warnings for at least some of 
the stuff that was deprecated in C++11, so they will not remove those 
any time soon. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91383#c1


In libc++, the deprecation warnings were shown since C++11 and now with 
C++17 they removed some stuff. On Linux you will have to build with the 
-stdlib=libc++ option for clang to notice. See e.g. 
https://godbolt.org/z/6Y1eE3z4P for playing with it.


But I digress ...

So the question is: did you notice things that have been removed from 
the C++ standard since C++11 that were used in our applications?


Cheers,
Frederik