Click here to Skip to main content
15,912,205 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Modern C++ auto Pin
Dean Roddey23-Apr-19 15:50
Dean Roddey23-Apr-19 15:50 
GeneralRe: Modern C++ auto Pin
Rage23-Apr-19 20:46
professionalRage23-Apr-19 20:46 
GeneralRe: Modern C++ auto Pin
Andy Hoffmeyer24-Apr-19 4:14
Andy Hoffmeyer24-Apr-19 4:14 
GeneralRe: Modern C++ auto Pin
wheelman570z24-Apr-19 7:11
professionalwheelman570z24-Apr-19 7:11 
GeneralRe: Modern C++ auto Pin
Andy Hoffmeyer24-Apr-19 7:41
Andy Hoffmeyer24-Apr-19 7:41 
GeneralRe: Modern C++ auto Pin
Dean Roddey24-Apr-19 7:55
Dean Roddey24-Apr-19 7:55 
GeneralRe: Modern C++ auto Pin
Rick Shaub24-Apr-19 9:33
Rick Shaub24-Apr-19 9:33 
GeneralRe: Modern C++ auto Pin
Dean Roddey24-Apr-19 10:00
Dean Roddey24-Apr-19 10:00 
I gave one below and I'm sure that they know about them and they cannot address this, because it's fundamental to why auto is dangerous.

C++
auto whatever = GetSomething()
while (somecondition)
   whatever++;


If you accidentally change the right side to anything that provides a ++ operator (anything that is syntactically valid for the loop), the compiler will never know that's wrong, because you are not providing the compiler with information about your intent. The compiler is only being given SYNTACTICAL guidance when you use auto, not SEMANTIC guidance, which is what it needs to help you in this situation.

If you provide the actual type, then you are telling the compiler what your intent is, i.e. semantic information, and so you have to make two parallel errors in most cases for this to silently cause a bug. Otherwise, you won't know until you somehow realize that something isn't getting incremented as it should be which could have most likely been caught at compile time with explicit typing.
Explorans limites defectum

GeneralRe: Modern C++ auto Pin
Rick Shaub24-Apr-19 10:05
Rick Shaub24-Apr-19 10:05 
GeneralRe: Modern C++ auto Pin
Dean Roddey24-Apr-19 10:19
Dean Roddey24-Apr-19 10:19 
GeneralRe: Modern C++ auto Pin
Rick Shaub24-Apr-19 10:25
Rick Shaub24-Apr-19 10:25 
GeneralRe: Modern C++ auto Pin
Dean Roddey24-Apr-19 10:45
Dean Roddey24-Apr-19 10:45 
GeneralRe: Modern C++ auto Pin
Rick Shaub24-Apr-19 11:52
Rick Shaub24-Apr-19 11:52 
GeneralRe: Modern C++ auto Pin
Dean Roddey24-Apr-19 12:00
Dean Roddey24-Apr-19 12:00 
GeneralNot Modern C++ auto Pin
bVagadishnu24-Apr-19 10:56
bVagadishnu24-Apr-19 10:56 
GeneralRe: Modern C++ auto Pin
Dean Roddey24-Apr-19 7:26
Dean Roddey24-Apr-19 7:26 
GeneralRe: Modern C++ auto Pin
Carlosian24-Apr-19 5:38
Carlosian24-Apr-19 5:38 
GeneralRe: Modern C++ auto Pin
Rick York24-Apr-19 6:48
mveRick York24-Apr-19 6:48 
GeneralRe: Modern C++ auto Pin
Dean Roddey24-Apr-19 8:02
Dean Roddey24-Apr-19 8:02 
GeneralRe: Modern C++ auto Pin
Rick York24-Apr-19 10:51
mveRick York24-Apr-19 10:51 
GeneralRe: Modern C++ auto Pin
Dean Roddey24-Apr-19 10:52
Dean Roddey24-Apr-19 10:52 
GeneralRe: Modern C++ auto Pin
Mark_Wallace24-Apr-19 11:11
Mark_Wallace24-Apr-19 11:11 
GeneralThought of the Day Pin
OriginalGriff23-Apr-19 4:42
mveOriginalGriff23-Apr-19 4:42 
GeneralRe: Thought of the Day Pin
Daniel Pfeffer23-Apr-19 4:49
professionalDaniel Pfeffer23-Apr-19 4:49 
GeneralRe: Thought of the Day Pin
megaadam23-Apr-19 4:53
professionalmegaadam23-Apr-19 4:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.