this post was submitted on 21 Oct 2023
238 points (95.1% liked)

Programmer Humor

19310 readers
1627 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@programming.dev 12 points 11 months 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 11 months ago

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