this post was submitted on 16 Jan 2024
10 points (100.0% liked)

Programmer Humor

19537 readers
505 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
top 6 comments
sorted by: hot top controversial new old
[–] [email protected] 0 points 10 months ago* (last edited 10 months ago) (1 children)
[–] [email protected] 0 points 10 months ago

Known to cause heisenbugs. They're bugs that disappear when you try to measure them with a debugger or a printf.

[–] [email protected] 1 points 10 months ago (2 children)

Put it in an if-else and it executes both blocks.

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

Fun fact I learned today - you know how when there's a compound conditional, the interpreter stops once the result is known? (Eg, if the left side of an and is false, it's false so it doesn't bother checking the second condition)

Apparently, visual basic doesn't do this thing every other language I know of does... It might be a debug only thing for the convenience of the depreciated ide I'm forced to use, but I did a null check && called a function on it if it's not null, and it blew up

I pride myself on my ability to change to a new programming language and make progress on day one, but vb is truly the most disgusting POS language I've ever seen. From syntax to jarring inconsistencies in language design, it's just gross

[–] [email protected] 1 points 9 months ago
  1. That's behaviour that's just part of language design. If you rely on it you should probably check how the language you're using handles it.

  2. relying on that behaviour sounds a lot like "clever" (read unnecessarily unreadable) code

[–] [email protected] -1 points 10 months ago

But only if you don't look