darkpanda

joined 1 year ago
[–] [email protected] 12 points 6 months ago (1 children)

Learn to use git bisect. If you have unit tests, which of course you should, it can save you so much time finding weird breakages.

[–] [email protected] 12 points 6 months ago

Donald Knuth, author of The Art Of Computer Programming, basically our bible, famously doesn’t use email.

[–] [email protected] 2 points 6 months ago

How do you know that deleting anything on Reddit actually deletes anything? It might just hide the content but soft delete it in the database, which means you may not be able to see it anymore but they can still use it for whatever.

[–] [email protected] 6 points 7 months ago* (last edited 7 months ago) (1 children)

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.

[–] [email protected] 20 points 7 months ago (7 children)

I also sometimes wish that the syntax in if statements was inverted, where () was optional and {} was required.

[–] [email protected] 6 points 8 months ago

If I choose red, I wouldn’t be able to guarantee my daughter would be born even if I met my wife because of, well, biology, but if choose the blue pill I can make sure she’ll have a huge head start on life from this point out, so blue pill it is.

[–] [email protected] 3 points 8 months ago (1 children)

Watched this over the Christmas break. The best review I had read from someone else was from a post on Lemmy that said something to the effect of “if you set up a TV to play 10 generic sci-fi movies and just changed the channel between them allrandomly you’d end up with a film as cohesive as Rebel Moon.”

[–] [email protected] 37 points 9 months ago (1 children)

Even with just one bit and a few switches this seems like the sort of thing Picard could use to send an encoded message to Riker and Data in the future should the need arise.

[–] [email protected] 9 points 9 months ago (4 children)

The truly fancy places call ‘em “frites”, not French fries. That way they can charge an extra three bucks for the fanciness.

[–] [email protected] 3 points 9 months ago

It’s also been a known thing ever since the demo occurred. This isn’t news, it’s been a known thing for basically the last 15 years.

view more: ‹ prev next ›