Liam
//return (a = (a > b ? a : b)) > c ? a : c; return a > b ? (a > c ? a : c) : (b > c ? b : c);
`std::max` could be faster than `? :` or if-else clause in this case.
harry
sure, but I'm still doing c
Liam
C also has max.
Liam
fmax?
It's a predefined macro, #define MAX(a, b) (((a) > (b)) ? (a) : (b)).
correctmaninwrongplace
This is the Kind of code that makes that when someone with less experience takes your Last job, he hates you
Liam
This is the Kind of code that makes that when someone with less experience takes your Last job, he hates you
It's okay, as a short inlined function with the comments. However, not recommended in product codes.
Anonymous
int max = (a > b ? a : b); return (max > c ? max : c);
You are wasting 4 bytes of memory in this sentence xd
Isc
You are wasting 4 bytes of memory in this sentence xd
not really if this is constexpr https://godbolt.org/g/BmMmhQ
harry
`std::max` could be faster than `? :` or if-else clause in this case.
not really sure why it would be faster when its just doing the same thing
Isc
`std::max` could be faster than `? :` or if-else clause in this case.
not true, std::max is adding 1 extra call to the call stack
Liam
not true, std::max is adding 1 extra call to the call stack
It won't, std::max is inlined, and no call stack frame will be added.
Isc
dont rely on "possible" compiler optimizations
Isc
there are many overloads, someday you will use one of them thinking that it will be inlined but nope
Liam
That's why "in this case" was applied to enclose the discussion.
Isc
in this case in this specific compiler with this specific version, compiling to this specific platform, under those specific conditions and using those libs
Liam
That's what the term "in this case" mean.
Isc
okay, tell me the OS, version, compiler, compiler version, linked libs, stl version, cpu architecture etc of @jolieblonde
Isc
if they dont match, then you dont know them
Isc
so you cannot rely on compiler optimizations
Liam
No I won't do that for you. It's you, yourself, claimed that I DO NOT KNOW THOSE. Hence it's your responsibility to find evidences to prove your statement, not me. Also, I'm not trying to be a programming language lawyer here, because what I want to show to Harry is that he need not to think about how to write his code in a very simple situation, for the reason that in this case and in most case, compilers are much smater than most programmers. Hence, just write codes in a simple and clear way, with as less tricks as possible.
Liam
Fine for that. Then, where are the evidences for your statement?
Isc
Fine for that. Then, where are the evidences for your statement?
the only way for you to prove that im wrong is to prove that you know them
Isc
then, my statement is true until you prove it
Liam
lol Following your words, I could blame you in any way and any words, and if you could not prove yourself from those censure, or you just feel tired to do those stupid things, I'm right?
Liam
Actually, this is how vilification works.
Liam
And what you said is vilification but not discussion.
harry
this is just like when mum and dad got divorced 😭
Liam
Actually, this is how scientific statements work If you can't prove something's false, then it's probably true
They are different. In scientific world, if you think other's paper is wrong or has defect, you've to show your proof or the process of your experiment to the public, and then ask the authors to fix the gap. However, in the world of vilification, smearors do not give their proofs or experiment processes, but just saying "you're wrong". Calling into question is different to vilification.
Liam
this is just like when mum and dad got divorced 😭
You must be kidding... I would not marry someone with different weltanschauung to me.
Liam
dont blame my weltanschauung
I didn't. I'm just saying we have different weltanschauung.
Isc
different == worse
Liam
different == worse
Well, that's one of the difference between our weltanschauungs. In my eyes, different != worse.
harry
plural is Weltanschauungen ☝
Isc
weltanschauungses don't overload operator==
Liam
plural is Weltanschauungen ☝
Thanks for that. But for the American Heritage Dictionary of English Language, Weltanschauungen and Weltanschauungs are both accepted.
harry
interesting
harry
it just sounds very wrong for German ears
Liam
https://www.merriam-webster.com/dictionary/weltanschauungen Also for MW.
deltanicola
It takes more ro write it than to spell it
Liam
it just sounds very wrong for German ears
I know. The word comes from German.
Anonymous
Weltanschauung ist german, yes
Anonymous
Weltanschauungs...
Anonymous
lol
Darkhan
Hiii!!!
Anonymous
std::cout « "Hi!\n";
Darkhan
I learn loop c++ while,for
Darkhan
Please ,help
Darkhan
I don't understand this topic
Anonymous
I don't understand this topic
Ask the specific doubt.
correctmaninwrongplace
Mother of god, you can be so Wild Talking about C++ xDD
correctmaninwrongplace
By the way, the guy with a exam have posted some code trying to solve it?
Anonymous
lol
Anonymous
dunno
Anonymous
I learn loop c++ while,for
What don't you uinderstand?
Anonymous
The concept of looping itself?
Darkhan
While && For Loop
Darkhan
while() for()
Anonymous
ok
Anonymous
What exactly?
Anonymous
while checks the condition. If it is true, it executes the code in its body. Then it checjs the condition again etc. If the condition is false, it skips the code in its body
Anonymous
Any non-zero value is treated as true iirc (It's certainly true for C)
Anonymous
But that's not important
deltanicola
Anyway, imagine a code like that int i=0; while(i<10){ //code i++; } While i stays under the value written in the parenthesis, the code in the while loop is executed With the for, you can summarise for(int i=0; i<10; i++){ //code }
Anonymous
;
Anonymous
in the for loop
Anonymous
:D