Click here to Skip to main content
14,356,770 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: when algorithms attack Pin
honey the codewitch16-Aug-19 6:31
memberhoney the codewitch16-Aug-19 6:31 
GeneralRe: when algorithms attack Pin
Sander Rossel16-Aug-19 6:37
professionalSander Rossel16-Aug-19 6:37 
GeneralRe: when algorithms attack Pin
Jon McKee16-Aug-19 10:27
professionalJon McKee16-Aug-19 10:27 
GeneralRe: when algorithms attack Pin
honey the codewitch16-Aug-19 10:32
memberhoney the codewitch16-Aug-19 10:32 
GeneralRe: when algorithms attack Pin
honey the codewitch16-Aug-19 10:34
memberhoney the codewitch16-Aug-19 10:34 
GeneralRe: when algorithms attack Pin
Sander Rossel16-Aug-19 10:52
professionalSander Rossel16-Aug-19 10:52 
GeneralRe: when algorithms attack Pin
Jon McKee16-Aug-19 11:29
professionalJon McKee16-Aug-19 11:29 
GeneralRe: when algorithms attack Pin
Sander Rossel16-Aug-19 11:52
professionalSander Rossel16-Aug-19 11:52 
Jon McKee wrote:
on the flip-side you can accidentally add code inside a brace that isn't meant to be looped (albeit probably less common)
Much less common, so much more preferred in my opinion Smile | :)
People do make mistakes with braces, but usually only when it's deeply nested with many many braces, which isn't something you should have anyway.
Jon McKee wrote:
braces vs no braces is exactly a specification of what the code should or should not be doing on a static basis
Only as you said, should do one thing vs. should do x things, but that's something that changes with specs, and both can be easily changed.
The difference is that when the specs are changed to "if x do y and now also z" the code with braces is almost certain to be changed correctly, but without braces that change is more likely to cause a bug.
It's not even entirely true, because if that one statement is a function call it could still be doing a gazillion things in that function Smile | :)

Another example of how it could cause a bug is the following:
if (x)
//   DoSomething(); Commented out for now.
AlwaysDoThis();
And what about this?
if (x)
   if (y)
      DoSomething();
   else
      DoSomethingElse();
Is that an else for x or y?

GeneralRe: when algorithms attack Pin
Jon McKee17-Aug-19 11:19
professionalJon McKee17-Aug-19 11:19 
GeneralRe: when algorithms attack Pin
Sander Rossel17-Aug-19 11:34
professionalSander Rossel17-Aug-19 11:34 
GeneralRe: when algorithms attack Pin
honey the codewitch16-Aug-19 11:30
memberhoney the codewitch16-Aug-19 11:30 
GeneralRe: when algorithms attack Pin
Sander Rossel16-Aug-19 11:59
professionalSander Rossel16-Aug-19 11:59 
GeneralRe: when algorithms attack Pin
honey the codewitch16-Aug-19 12:02
memberhoney the codewitch16-Aug-19 12:02 
GeneralRe: when algorithms attack Pin
Sander Rossel16-Aug-19 12:09
professionalSander Rossel16-Aug-19 12:09 
GeneralRe: when algorithms attack Pin
honey the codewitch16-Aug-19 12:16
memberhoney the codewitch16-Aug-19 12:16 
GeneralRe: when algorithms attack Pin
Sander Rossel17-Aug-19 2:35
professionalSander Rossel17-Aug-19 2:35 
GeneralRe: when algorithms attack Pin
honey the codewitch17-Aug-19 4:16
memberhoney the codewitch17-Aug-19 4:16 
GeneralRe: when algorithms attack Pin
Sander Rossel17-Aug-19 5:08
professionalSander Rossel17-Aug-19 5:08 
GeneralRe: when algorithms attack Pin
honey the codewitch17-Aug-19 5:14
memberhoney the codewitch17-Aug-19 5:14 
GeneralRe: when algorithms attack Pin
Sander Rossel17-Aug-19 5:27
professionalSander Rossel17-Aug-19 5:27 
GeneralRe: when algorithms attack Pin
honey the codewitch17-Aug-19 5:30
memberhoney the codewitch17-Aug-19 5:30 
GeneralRe: when algorithms attack Pin
Sander Rossel17-Aug-19 5:32
professionalSander Rossel17-Aug-19 5:32 
GeneralRe: when algorithms attack Pin
honey the codewitch17-Aug-19 5:41
memberhoney the codewitch17-Aug-19 5:41 
GeneralRe: when algorithms attack Pin
dandy7216-Aug-19 6:06
memberdandy7216-Aug-19 6:06 
GeneralRe: when algorithms attack Pin
honey the codewitch16-Aug-19 6:08
memberhoney the codewitch16-Aug-19 6:08 

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.