Click here to Skip to main content
15,900,378 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 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 
Really the above isn't the issue. The issue is this:

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


In a large code base, there are probably a hundred or more things that would be syntactically compatible with that, so that accidentally changing GetSomething(), either manually or via search and replace, such that it returned one of those types, would create a completely silent error.

Is it going to happen every day? No, obviously not. But that's not the point. The point is that, this:

C++
FailureCounter& failCnt = GetFailCounter();
while (somecondition)
    failCnt++;


is just far less likely to be subject to such a silent error because you have to make two parallel errors for that to happen. You are expressing your intent to the compiler by using an explicit type, which is the only way the compiler can know if your intent is not being followed.

And how much extra work did that take to get the extra safety? Almost nothing.
Explorans limites defectum

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 
GeneralRe: Thought of the Day Pin
Jörgen Andersson23-Apr-19 5:08
professionalJörgen Andersson23-Apr-19 5:08 
RantRe: Thought of the Day Pin
lopatir23-Apr-19 5:14
lopatir23-Apr-19 5:14 
GeneralRe: Thought of the Day Pin
Herman<T>.Instance23-Apr-19 5:28
Herman<T>.Instance23-Apr-19 5:28 
GeneralRe: Thought of the Day Pin
W Balboos, GHB23-Apr-19 5:30
W Balboos, GHB23-Apr-19 5:30 
GeneralRe: Thought of the Day Pin
Gary R. Wheeler23-Apr-19 11:31
Gary R. Wheeler23-Apr-19 11:31 
GeneralWSO CCC OTD 2019-04-23 Pin
OriginalGriff22-Apr-19 21:40
mveOriginalGriff22-Apr-19 21:40 
GeneralRe: WSO CCC OTD 2019-04-23 Pin
musefan22-Apr-19 22:13
musefan22-Apr-19 22:13 
GeneralRe: WSO CCC OTD 2019-04-23 - we have a winner! Pin
OriginalGriff22-Apr-19 22:19
mveOriginalGriff22-Apr-19 22:19 
GeneralRe: WSO CCC OTD 2019-04-23 Pin
Fueled By Decaff23-Apr-19 2:28
Fueled By Decaff23-Apr-19 2:28 
GeneralRe: WSO CCC OTD 2019-04-23 Pin
musefan23-Apr-19 3:06
musefan23-Apr-19 3:06 
GeneralMini CCCs 81 Pin
Tim Deveaux22-Apr-19 19:17
Tim Deveaux22-Apr-19 19:17 

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.


Straw Poll

Were you affected by the geomagnetic storms this past weekend?
Communication disruptions, electrified pipes, random unexplained blue-screens in Windows - the list of effects is terrifying.
  Results   485 votes