Well, Jow Forums?

well, Jow Forums?

Attached: 1542326733286.png (471x785, 72K)

Other urls found in this thread:

en.cppreference.com/w/cpp/algorithm/min
en.cppreference.com/w/cpp/algorithm/max
twitter.com/SFWRedditImages

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

Attached: Screen Shot 2018-11-15 at 17.19.15.png (570x413, 40K)

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) ?

Attached: 1534471277430.png (331x331, 76K)

You're not thinking with pointers.

>en.cppreference.com/w/cpp/algorithm/min
>1-2) The smaller of a and b. If the values are equivalent, returns a.
>en.cppreference.com/w/cpp/algorithm/max
>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

Attached: 1531873728138.jpg (869x781, 179K)

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

Attached: tales_of_a_non-unicorn.png (1600x6283, 1.72M)

>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.

Attached: 1516023591523.jpg (900x900, 132K)

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

Attached: 7eqasz3m20r11.jpg (513x768, 45K)

is this bait?
is everyone trolling ITT?
it's obvious it would print 1010

ty user, now I can finish my homework.

Attached: cpp.jpg (584x360, 38K)

why does anyone use this god awful language

fucking this
everyone bashing c++ is a fucking brainlet
/thread

>not posting the original

Attached: 1456027623647.jpg (869x1758, 234K)

>applel
fuck off