If you want some more perfect ideas check out the git for “Gulf of Mexico”, there’s some golden ideas there
Technical details: Due to an executive order from President Trump, imported units will be subject to a 25% tariff, that is, imported code will run 25% slower and, at random, 25% of your code (lines) will be lost.
omg. That's what I get for commenting on a Sunday. It's not like a write C for a living or anything like that.
Wouldn't x//, being x /= 1 also be a no-op though?
I like the idea of being able to use x%% to check for integers, although it might have limited use given that the % operator isn't defined for float types.
x//; comments out the semicolon and whatever is on the next line most likely isnt a valid continuation of x
i guess you would just have to implement % for floats and then be able to use it? and even then that would be a bit weird since it would be possible that you wouldn't get an exact value due to whatever rounding shenanigans floats are doing
I think just to piss off compiler writers, x//; should be valid syntax despite C++ style comments being a thing in C.
Yeah I'd definitely be up for having % for float types, fmod() can get stuffed. The idea of 'exact values' when using floats is a fuzzy concept at the best of times so I think we're good. The mathematicians might have something to say about having a modulo operator for (pretend) reals, but that's their problem.
All good with 'noop', I think most people use nop and noop/no-op interchangeably. I tend to differentiate by using nop if I'm talking about a no-op cpu instruction, or no-op if I'm talking about an operation (well, lack of) in a more general or abstract sense, but I'm pretty sure I sometimes annoy my colleagues with my attempts to be more precise with language (when I'm not getting basic things wrong like in my earlier comments of course).
Which is a shame, since that's a better semantic match for x = x + 1, but I guess it's moot since x += 1 is a statement and not an expression, spoiling the whole symmetry anyway.
EDIT: not sure where I picked up the notion that compound assignments weren't expressions (specifically in c++; can't speak for other languages)
You sure that isn't an expression? I'm positive x = 1 is an expression that returns 1 (unless in an initialization), so this one should return x + 1.
E: Oh yeah, it's 100% an expression. It's the reason people would get bitten by accidentally writing = instead of == inside an if condition, and the whole reason behind shit like Yoda conditionals.
I see you edited your post and deleted your reply to me. I was going to ask what the motivation for x += 1 not being an expression when x = 1 is, and was thinking of testing for myself on Godbolt.
393
u/sokjon Nov 23 '25
We laugh but -=- is probably some Haskell Lens operator
122
u/csabinho Nov 23 '25
I love using this as a mix of ASCII art and protest against the missing ++ operator.
112
u/amarao_san Nov 23 '25
x-=-xAt least it's symmetric.
49
u/ZylonBane Nov 23 '25
Do the people who post these things here just not know that r/programminghumor exists?
16
u/cantbelieveyoumademe Nov 23 '25
Bottom one has a certain beauty to it.
24
u/Code_Noob_Noodle Nov 23 '25
No ++x? 😞
6
u/thebigbadben Nov 23 '25
x-=~0
3
u/_AscendedLemon_ Nov 23 '25
-=- looks like bored duck from the front
3
u/Complete-Ambassador2 Nov 23 '25
x *= (x+1)/x
3
u/Krisanapon Nov 24 '25
x++ + ++x
x-- - --x
2
u/KaMaFour Nov 23 '25
Absolute javascript
let x = "1"; //substitute for any other way you get a number which might be a string
x-=-1 // 2
2
u/JiminP Nov 24 '25
2
u/CandidTangerine1581 Nov 25 '25
I don't think it's not a good way to do it team
2
u/Skyrmir Nov 23 '25
It's been years and I'm still raging about finding X = X * (1/2) in production code.
1
u/Jesus_Chicken Nov 23 '25
Spooderman math
1
u/v_maria Nov 23 '25
I assume its ub lol
1
u/GamingWOW1 Nov 23 '25
What about ++x?
1
u/Competitive_Ad2539 Nov 24 '25
modify succIt's not me who's saying this, but my addiction to Haskell.
1
u/goos_ Nov 25 '25
Why has this been posted like 3 times
1
u/xXxGlitch_LordxXx Nov 26 '25
Thats the math problem let it resolve himself
1
u/daniel_ben-tal Nov 27 '25
X /= X/(X+1)