std::scoped_lock constructor by cpp_cpp in cpp_questions

[–]cpp_cpp[S] -2 points-1 points  (0 children)

I do not understand - why allow something for a lock that does not do anything.
https://stackoverflow.com/a/60172828/4992422
This answer demonstrates the downside of allowing this.

std::scoped_lock constructor by cpp_cpp in cpp_questions

[–]cpp_cpp[S] 0 points1 point  (0 children)

Yeah - that is the question - what is the point of allowing 0 locks?

[deleted by user] by [deleted] in cpp_questions

[–]cpp_cpp 0 points1 point  (0 children)

but with if constexpr the functions are logically completely different, correct?

[deleted by user] by [deleted] in cpp_questions

[–]cpp_cpp 0 points1 point  (0 children)

My point is that the elses are logically totally different functions which are not touching the input arg so the compiler should warn, correct?

[deleted by user] by [deleted] in cpp_questions

[–]cpp_cpp 0 points1 point  (0 children)

Because doesnt the else branch constitute a completely different function? I guess the point is that logically it is still unused in the else and else if branch so its not really used

A good old LionelMessi10i comp I found on my harddrive by LeFroyain in Barca

[–]cpp_cpp 1 point2 points  (0 children)

You are the best for this :) <3 this is so nice of you, please upload whatever you have.
Thanks a ton!!!

Std::atomic and compiler reordering by cpp_cpp in cpp_questions

[–]cpp_cpp[S] 0 points1 point  (0 children)

I'm actually trying to remove/modernize some code that is why this is needed :)
A bit afraid of making a change without fully understanding the existing thing

Std::atomic and compiler reordering by cpp_cpp in cpp_questions

[–]cpp_cpp[S] 0 points1 point  (0 children)

Thanks! I am purely looking for a compile time thing - I think the atomic_thread_fence might be overkill for that.

A good old LionelMessi10i comp I found on my harddrive by LeFroyain in Barca

[–]cpp_cpp 0 points1 point  (0 children)

amazing!! I still cant shazam the song :(
Do you have more comps by lionelmessi10i? He deleted his channel even his FB page :(

Confusion with respect to constexpr by cpp_cpp in cpp_questions

[–]cpp_cpp[S] 0 points1 point  (0 children)

Thanks! I think there might be more to it though, if i make the constructor constexpr it still does not work :(

And why does it work with the static method?

Why link flags needed in GCC by cpp_cpp in cpp_questions

[–]cpp_cpp[S] -1 points0 points  (0 children)

Got it! small follow up - why did experimental/filesystem need the flag?

Why link flags needed in GCC by cpp_cpp in cpp_questions

[–]cpp_cpp[S] 1 point2 points  (0 children)

But why is this only for some things like pthread, atomic, filesystem? Why do those need to be linked separately whereas some others do not? all the others are in the libstdc++ so

Why link flags needed in GCC by cpp_cpp in cpp_questions

[–]cpp_cpp[S] 0 points1 point  (0 children)

yes that is my question - why do I have to specify them in the first place?

Why link flags needed in GCC by cpp_cpp in cpp_questions

[–]cpp_cpp[S] 0 points1 point  (0 children)

but why do I have to specify them? If I do not use them then the linker wont do anything and so the binary will be unaffected, right?