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

Programmer Humor

25531 readers
1598 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 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] nybble41@programming.dev 10 points 2 years 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@programming.dev 1 points 2 years ago

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