this post was submitted on 21 Oct 2023
258 points (94.8% liked)

Programmer Humor

19551 readers
1012 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
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 12 points 1 year ago (1 children)

I'm fairly certain that last one is UB in C. The result of an assignment operator is not an lvalue, and even if it were it's UB (at least in C99) to modify the stored value of an object more than once between two adjacent sequence points. It might work in C++, though.

[โ€“] [email protected] 1 points 1 year ago

That was my first thought when trying to figure out what it did