Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 5
    if you want to simplify something you can start from using if (startDate) instead of if (startDate == true) :) Commented Mar 7, 2019 at 19:54
  • 6
    I would strongly question whether avoiding variables in C is a good idea. C compilers are generally good at optimizing out locals. Commented Mar 7, 2019 at 20:59
  • 13
    "I know some languages (C comes to mind) its best to declare as few variables as possible" - honestly, this sounds like a very unfounded, superstitous believe to me, do you have any references for this strange recommendation? Who told you this? Commented Mar 7, 2019 at 21:18
  • 8
    For readability's sake, startDate is a terrible name for a Boolean variable. If I randomly saw startDate somewhere in a block of code and did not see the type declaration, Boolean would definitely not be the type I'd infer. Commented Mar 7, 2019 at 21:58
  • 3
    "I know some languages (C comes to mind) its best to declare as few variables as possible" - That's just wrong, and you can easily see why, because the compiler will typically produce the exact same assembly, at least when you provide the usual optimisation flags. Please compare: godbolt.org/z/0H3RKj & godbolt.org/z/9hPdie Commented Mar 8, 2019 at 9:26