this post was submitted on 21 Oct 2023
283 points (94.6% liked)

Programmer Humor

19593 readers
446 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
[โ€“] nybble41 14 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.

[โ€“] Beanie 2 points 1 year ago

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