Is C++ a rigorously typed language?

One of the recent Embarcadero “CodeRage 2018” webinars was about some of the features in C++ 17.

This included some talk about the “auto” key word and associated encouragement to use it. I’m less convinced about using this in a carefree manner. When you declare a variable or (in C++ 17) a return value who is the sensible person to choose what type it is? The compiler or you?

It’s a great typing saver when you are declaring an iterator for one of the standard library containers (eg a vector). So use it for this.

But I’m not so sure about using it in cases where some careless modification of code might unintentionally change the type of a variable or return value. I feel (because I am used to it) that the strong rigorous typing enforced by earlier C++ standards (before the introduction of the “auto” keyword) is an advantage of the language not a disadvantage.

So yes, use “auto” but only WITH CARE.

Advertisements

Embarcadero RAD Studio – Code Rage 2018 is Coming

Behind Embarcadero’s first class products are a strong on-line community and a company keen to keep it’s customer base bang up to date with what’s going on. One way they achieve this is an annual on-line event, “Code Rage. This is a free series of presentations that cover a very wide range of programming aspects. It most definitely is NOT a series of sales or marketing talks!

It’s free to anyone and registration is simple and quick. Once registered there is no obligation to attend any o the on-line events, but when you see the line up, why wouldn’t you?

To register, head over to Embarcadero CodeRage 2018