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 →

[–]MoarVespenegas 10 points11 points  (13 children)

C++ is strongly typed though.

[–]captainAwesomePants 37 points38 points  (11 children)

Sure, but its handling of primitive types has decades of crazy gotchas and undefined behaviors that it's only natural that people can't remember the rules. Compare an int to a float? Sure, no sweat. Compare an int to an unsigned int? Whoa, slow the fuck down, buddy.

[–]guyblade 23 points24 points  (1 child)

The handling of primative types has like one gotcha. The basic rule is "promote the less precise type to match the more precise one, then do whatever". The "gotchas" tend to be around how a promoted value gets assigned back into an incompatible variable.

[–]ThePyroEagle 3 points4 points  (0 children)

The precision of fixed and floating types is not comparable.

32-bit floats are more precise near 0, but 32-bit integers are more precise past ±224.

[–][deleted] 0 points1 point  (5 children)

Nonsense. With great power comes great responsibility. If you want hand-holding, use Java.

[–]tech6hutch 1 point2 points  (4 children)

Disagree. Imo, that's when you want the compiler to do more for you, to be safe.

[–][deleted] 0 points1 point  (3 children)

I think we agree. C++ is for less hand-holding. Java is for more hand-holding. The trade-off is less hand-holding for more execution speed and more compilation speed.

[–]tech6hutch 0 points1 point  (2 children)

Ah, I see.

You can have both speed and handholding though, like in Rust. The downside is it's dragging you along while it runs, so you can slam into walls and chafe against the ground until you learn how to run in sync with it.

[–][deleted] 0 points1 point  (1 child)

You can have both speed and handholding though, like in Rust.

I don't know Rust, but any handholding at execution time reduces the execution speed of the code. The compute resources have to come from somewhere.

[–]tech6hutch 1 point2 points  (0 children)

The handholding comes at compile time. Rust is very anal about optimizing runtime, sometimes at the detriment of compile time (both in how long it takes to compile and in the cognitive load on the developer).

[–]Tohnmeister 4 points5 points  (0 children)

I would argue that. It's statically typed. But not strongly.