• 0 Posts
  • 31 Comments
Joined 1 year ago
cake
Cake day: June 13th, 2023

help-circle









  • The code in the image is C or C++ or similar. In those languages and languages derived from them, curly braces are optional but the parentheses are required. It should be the other way around to avoid logic errors like this:

    if (some expression)
      doSomething()
    else if (some other expression)
      printf(“some debugging code that’s only here temporarily”);
      doSomethingElse();
    

    Based on the indentation you’d think that doSomethingElse was only meant to run if the else if condition was true, but because of the lack of braces and the printf it actually happens regardless of either of the if conditions. This can sometimes lead to logic errors and it doesn’t hold up to a principle of durability under edit — that is, inserting some code into the if statement changes the outcome entirely because it changes the code path entirely, so the code is in a sense fragile to edits. If the curly braces were required instead of optional, this wouldn’t happen.

    I have all of my linters set up to flag a lack of curly braces in these languages as an error because of this. It’s a topic that sometimes causes some debate, ‘cause some people will vociferously defend their right to not have the braces there for one liners and more compact code, but I have found that in general having them be required consistently has led to fewer issues than having arguments about their absence, but to each their own. I know many big projects that have the opposite stance or have other guidelines, but I just make ‘em required on my own projects or projects that I’m in charge of and be done with it.




  • I prefer to think that Picard is just still stuck in the Nexus and everything that has happened to him since has been a result of magic Nexus fever dreams.

    Movie Picard and PIC Picard acted nothing like TNG Picard to the point where they were seemingly completely different people. Movie Picard wanted to make the Borg pay for what they did and literally beat in dead Borg with his fists and snapped the Borg queen’s spine in two with his bare hands while TNG Picard knew things weren’t that cut and dry and even had an opportunity to potentially genocide the works of them and didn’t because ethics and shit. Movie Picard would have drove Hugh up to their doorstep infected with the fractal virus the first chance he had.

    PIC Picard… is literally an android I guess? But still old? They kind of ignored that later. So, literally he isn’t the same Picard as TNG Picard.

    The Nexus is my head canon.



  • Depends on the situation. Sometimes they only find out that the planet they’re beaming down to is actually a 1920’s mafia planet or a Nazi Germany planet after the fact once they get there, and then it’s like, “Bones, Spock, and also random Crewman, we’ve just beamed down to a mafia planet, we need to get some proper clothes before we’re spotted. Oh no, we’ve been spotted, beat these mafia guys up and steal their clothes quick before we’re spotted again.”

    Although to be fair those sorts of episodes actually didn’t involve time travel, since they were other planets that for some reason or another became entire planets of mafiosos and Nazis, but the prime directive still applied.



  • I once fixed a bug in credit card payment form because someone had gotten some formatting character screwed up and used a capital M in some place where a lower case m should have been. Since it was a payment system they couldn’t take payment for a while whilst that was screwed up. I was contracting there and happened to notice it. Sometimes all it takes is one character.