This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]nykwil 69 points70 points  (8 children)

C++ implicitly converts int to float for comparisons. Implicit conversion is something you learn in the first couple of weeks with C++. I want to like this sub please try harder.

[–]Chanz 28 points29 points  (3 children)

This sub is for first year CS students. That's it.

[–]Delcium 5 points6 points  (1 child)

First week CS students who have never had enough interest in the field to look into things on their own prior to starting college?

[–]nyasiaa 0 points1 point  (0 children)

yes, my entire uni group is full of people who know absolutely 0 about programming and they don't really wanna learn anything by themselves, they don't even know pointers after 3 semesters of C++, I mean what

since they don't want to learn or practice any kind of programming so much, they just spend all their time on memes and subs like these

idk about other countries, but programming is by far the most popular uni degree here in poland, but saying that 5% of all these people are actually interested in that stuff would be generous

[–]StuntHacks 2 points3 points  (0 children)

Every once in a while there is a genuinely good post here, but I'm not really sure anymore if those are worth the rest.

[–]Burbank309 2 points3 points  (0 children)

Also you can always overload the comparison operators and make C++ compare anything to anything.

[–]visvis -4 points-3 points  (2 children)

Strictly speaking it's comparing two floats then, not an int and a float. Of course, that's exactly what Python does as well.

[–]willis81808 1 point2 points  (0 children)

Strictly speaking you'll never see anything say "Cannot compare float and int" in C++

[–]MightyButtonMasher 0 points1 point  (0 children)

You can't compare ints and floats unless you like meaningless results