well, Jow Forums?
Well, Jow Forums?
Other urls found in this thread:
en.cppreference.com
en.cppreference.com
twitter.com
1111 I think
this dick LMAO
ints are copy types, so it should be 1010 unless std::max is doing some absolutely retarded fuckery
I was right
1111 because min(a,b) amd max(a,b) both return a on equivalent, by standard.
lq bait, but made me reply
is it cause it's referencing the address of x for both min and max, since x and y are equal at time of std::max evaluation so it just takes the x address. and then sets x to 11 so when you reference in in printf you get effectively printf("%d%d",x,x) ?
You're not thinking with pointers.
>en.cppreference.com
>1-2) The smaller of a and b. If the values are equivalent, returns a.
>en.cppreference.com
>1-2) The greater of a and b. If they are equivalent, returns a.
it's so hard to read a sentence
yup, that's exactly what's going on
>ints are copy types
kys faggot
>integer
>by reference instead of value
for what fucking pvrpose? just to waste a couple more load immediate cycles?
>well, Jow Forums?
...do my homework for me...
'cause I'll be pumping your gas in five years.
>for what fucking pvrpose
because you want an alias to the max and min variables
>just to waste a couple more load immediate cycles
implying the compiler wont optimize away the aliases
Imagine thinking that a comparison operation between primitive types should return a reference to the primitive type rather than copy it. Fuck C++ honestly. The whole fucking language is basically like walking through a room with 1000 shotguns with millions off fishing lines attached to the triggers.
I'm pretty sure max and min are templated
so it returns whatever you pass them/want them to return, as long as the compiler thinks it's valid
55
Does it print 1111 because it's a reference and the value of x was changed to 11?
this so hard, i'll stick with D / Java / Go / Rust / $sane_option
yes, both min and max get a reference to x, since they are equal and x is first in the args list.
Im so glad i dont write c++ for a living
I do. You can avoid most of those problems easily.
Are dates a fucking nightmare in c++ like they are in java? I imagine doing math on decimals sucks a lot worse in c++ or do you have a wrapper object that handles it all like java does with BigDecimal?
there was an article about a girl coder, she would add comments to code instead of actually coding
There is no big decimal in the C++ standards, there are 3rd party libs though. Dates can suck, also sometimes even as a C++ dev you work with legacy C code, that can be pretty bad, like WinApi.
Link? I've got a folder of funny shit like that but I've never heard of the event you're describing
>Are dates a fucking nightmare in c++ like they are in java?
No idea about Java but Boost has a decent enough date time library.
Pretty obvious if you just look at the documentation for std::max and std::min. They take references and return a reference, and in the case of being equal they return the first argument. If you can't figure it out from that, you probably shouldn't be anywhere near a computer.
Why are millennials so resistant to the idea of utilizing documentation.
It's kind of annoying to read the doc for every single method, noone truly does that. Maybe when you face a bug or something, but not every time you use a method.
1111
It should return a reference.
If you wanted a copy then just remove the & and it'll copy.
If I'm comparing larger objects I should be able to get a reference to it rather than copying it.
It's the fucking standard library. I should hope that you read the fucking documentation if you're pretending to be a C++ programmer. How would you even know what functions even exist otherwise?
If reading documentation is "annoying", you shouldn't be anywhere near a computer.
I don't remember what he's talking about but I remember a different example of a girl having done "hundreds of commits on linux kernel" and got an award for it and once you check her github you see it's single line commits adding const to a variable hundreds of times.
Noone reads every single line for every single function in the standard. You rely on internal consistency and best practices. For example even if I don't know that std::max returns a reference, it doesn't matter if I simply copy. And no, I don't copy all the time, soemtimes it really doesn't matter for performance though.
Implicit referencing was a mistake.
That's actually a worthwhile contribution, assuming the variables actually should be const. Only worth a single commit per module though
is this bait?
is everyone trolling ITT?
it's obvious it would print 1010
ty user, now I can finish my homework.
why does anyone use this god awful language
fucking this
everyone bashing c++ is a fucking brainlet
/thread
>not posting the original
>applel
fuck off