does an advanced c++ programmer know all of C++ features

Started by
73 comments, last by hplus0603 2 years, 9 months ago

Complaining that you don’t know What the type is, do you really need that data that bad most of the time? No, you need that data in the statistically rare case, especially if the code is sensical. If your ide doesnt suck it takes one second to determine the type if there is not an error

Advertisement

That’s just saying there are very few reasons for C++ to be strongly typed. Properly assigning types helps reduce a wide variety of bugs from ever being made, such as index overflows, accidental truncation, mixed sign comparisons, etc. To at least a degree you are saying that because debugging problems caused by wrong types is rare, we should stop doing the thing that makes debugging problems caused by wrong types rare.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

The type is never unknown. The compiler always knows what it is if there’s no error. Saying tyoe inference could be a source of error is like saying you simply don’t know what the code is doing. and That would be true. the problem isn’t auto

When you are writing templated code are you constantly having type problems? the answer should be no and auto is no different

I join the worship of showing your type to me. Even i can hover to figure it out (which often takes much longer than a second), i need to remember it then, together with some other things. It's just harder all the time, while typing that type is work just once.

So i use auto only if the type can be indeed one of many and auto reduces complexity. Or if the type really is long like those STL container constructs.

It’s weird to argue that because the compiler knows it, my situation is the same as knowing it even though I don’t know it. Humans are the ones making inferences, and this is inference is aided by the IDE/code having the types explicitly declared; there is no particular purpose in bringing the compiler into the topic.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

auto [ x, y, z ] = foo();
modern cpp

This topic is closed to new replies.

Advertisement