Thread 105947817 - /g/ [Archived: 217 hours ago]

Anonymous
7/18/2025, 6:08:51 PM No.105947817
ist
ist
md5: 8a7dc60088ecc97a04fb91165c2ecfcf๐Ÿ”
>+=1 isn't good enough. lets add an entire operator to my language just for that
mental illness
Replies: >>105947848 >>105947911 >>105947942 >>105948187 >>105948399 >>105948444 >>105948996 >>105949379 >>105950911 >>105951183 >>105952108 >>105952689 >>105954276 >>105955387 >>105956214
Anonymous
7/18/2025, 6:13:40 PM No.105947848
>>105947817 (OP)
n++ and n+=1 are not equivalent
n+=1 is equivalent to ++n

At least be right if you're going to make a post like this.
Replies: >>105947877 >>105947891 >>105948899 >>105949042 >>105951843 >>105955224
Anonymous
7/18/2025, 6:18:03 PM No.105947872
brave_MV7f6fb5Zx
brave_MV7f6fb5Zx
md5: 481e8976df31eff26d1fb9c826a7798a๐Ÿ”
some architectures have an instruction that does this doe
Replies: >>105948932 >>105951829 >>105954191
Anonymous
7/18/2025, 6:18:40 PM No.105947877
>>105947848
>n+=1 is equivalent to ++n
No, n+=1 is not an rvalue. whereas ++n is.
At least be right if you're going to make a post like this.
Replies: >>105947891
Anonymous
7/18/2025, 6:20:06 PM No.105947891
>>105947877
>>105947848
both wrong. n++ is 2 operation in one. Return n, and then add
Replies: >>105947931 >>105951855
Anonymous
7/18/2025, 6:21:57 PM No.105947903
for loops are bloat, just use while loops
Replies: >>105952552
Anonymous
7/18/2025, 6:22:44 PM No.105947911
>>105947817 (OP)
>n = n+1 isn't good enough. let's add an entire operator to my language just for that
Anonymous
7/18/2025, 6:25:27 PM No.105947931
>>105947891
Please elaborate how my statement
>++n is [an rvalue]
is wrong. You have my undivided attention.
Replies: >>105947956
Anonymous
7/18/2025, 6:26:57 PM No.105947942
>>105947817 (OP)
++n and n++ are different constructs
Anonymous
7/18/2025, 6:28:40 PM No.105947956
Thats-Not-Even-a-Word
Thats-Not-Even-a-Word
md5: 986d15ab02e0bc477360963dc6166da4๐Ÿ”
>>105947931
++n is not an rvalue in C++. It's a modifiable lvalue, which is why you can do things like

>++n = 5;

In C, ++n is indeed an rvalue.

n + 1 is always an rvalue in both languages and has no side effects.

So no, ++n and n + 1 are not equivalent, neither in value category nor behavior.
Replies: >>105948010 >>105948442
Anonymous
7/18/2025, 6:35:31 PM No.105948010
>>105947956
>In C, ++n is indeed an rvalue.
I accept your concession and I am awaiting your apology.
Replies: >>105948060 >>105948324
Anonymous
7/18/2025, 6:41:25 PM No.105948060
>>105948010
since we never stated the language, you can keep awaiting
Replies: >>105948208
Anonymous
7/18/2025, 6:55:19 PM No.105948187
>>105947817 (OP)
Dumb shit
just do
>inc RAX

Done
Replies: >>105952994
Anonymous
7/18/2025, 6:57:19 PM No.105948208
>>105948060
Since we never stated the language, your original statement
>both wrong
was premature, wasn't it.
Replies: >>105948228
Anonymous
7/18/2025, 6:58:45 PM No.105948228
>>105948208
>Since we never stated the language, your original statement
>>both wrong
wrong
Anonymous
7/18/2025, 7:06:58 PM No.105948304
Rust doesn't have this problem.
Anonymous
7/18/2025, 7:09:57 PM No.105948324
>>105948010
Literally just entered this thread and read 0 posts. I accept your concession in advance. You may kiss my feet now.
Anonymous
7/18/2025, 7:10:28 PM No.105948330
>+=1
mental illness, use n = n + 1
Replies: >>105948370 >>105948373 >>105948391 >>105948472 >>105948736 >>105948897 >>105951054
Anonymous
7/18/2025, 7:14:43 PM No.105948370
>>105948330
>n = n + 1
Lua user spotted.
Anonymous
7/18/2025, 7:14:53 PM No.105948373
dorothy
dorothy
md5: 005ae1212a73ba3cdba22bb9140640ba๐Ÿ”
>>105948330
this but unironically
rest is bloat
Anonymous
7/18/2025, 7:16:50 PM No.105948391
>>105948330
oof using the same variable on both sides of the assignment operator? Very confusing.
Better to do:
new_var = n + 1; n = new_var
Replies: >>105948476 >>105952915
Anonymous
7/18/2025, 7:16:50 PM No.105948392
>these are the subhuman intellects crying that they can't get a programming job anymore
Anonymous
7/18/2025, 7:17:28 PM No.105948399
>>105947817 (OP)
stay away from computers
Anonymous
7/18/2025, 7:19:04 PM No.105948422
1751063033878499
1751063033878499
md5: 173af888a4089ef5fd91e3a756c0ba12๐Ÿ”
>comp sci 101
>devolves into brainlets arguing like its a 300 IQ problem
Replies: >>105948497 >>105954075
Anonymous
7/18/2025, 7:19:56 PM No.105948431
++ -- are code smells
Replies: >>105948510 >>105951793 >>105952640 >>105952669
Anonymous
7/18/2025, 7:20:04 PM No.105948433
ACKCHYUALLY C had ++ -- operators because they transleted to cheaper/smaller instructions for increment/decrement than arbitrary addition; and there was no optimizing compiler and they were either too constrained or lazy to detect right-hand-size. it's a bit of a historical artifact that became redundant as soon as compilers started to have at least minimal optimizations
Anonymous
7/18/2025, 7:20:11 PM No.105948435
n+=1 is garbage too, i hate these in-place operators
for me it will always be n=n+1
Anonymous
7/18/2025, 7:20:39 PM No.105948442
1642260627948
1642260627948
md5: 026d256c7afc265f0b0df584b3dc9876๐Ÿ”
>>105947956
picrel is bjarne dabbing on cniles
Anonymous
7/18/2025, 7:20:45 PM No.105948444
>>105947817 (OP)
It was added cuz the PDP-11 had support for it.
Anonymous
7/18/2025, 7:23:16 PM No.105948470
>i++
>i+=1
>i.inc()
>i = i + 1
Which one do you prefer the most, /g/?
Replies: >>105948875 >>105951978
Anonymous
7/18/2025, 7:23:50 PM No.105948472
>>105948330
Are you insane?!?
*pn = NULL;
n = 0;
pn = &n;
n = (*pn)++;
Anonymous
7/18/2025, 7:24:05 PM No.105948476
>>105948391
Good morning saar.
Replies: >>105952007
Anonymous
7/18/2025, 7:25:21 PM No.105948497
>>105948422
>Not even comp sci
>Feeling this insecure about a shitpost thread
The nocoder has outed himself once again.
Replies: >>105954075
Anonymous
7/18/2025, 7:26:22 PM No.105948510
>>105948431
Snopes verdict: false
Anonymous
7/18/2025, 7:39:22 PM No.105948654
brevity is wit
Anonymous
7/18/2025, 7:47:54 PM No.105948736
>>105948330
This, but n := n + 1
Replies: >>105950324
Anonymous
7/18/2025, 8:03:38 PM No.105948875
>>105948470
INCF i, 1
Anonymous
7/18/2025, 8:07:05 PM No.105948897
>>105948330
for me its set n (math '$n + 1')
Anonymous
7/18/2025, 8:07:35 PM No.105948899
>>105947848
Compiler: *optimizes all of these into the same thing* Heh, nothin' personnel kid
Replies: >>105948923
Anonymous
7/18/2025, 8:09:17 PM No.105948923
>>105948899
you need to use a new compiler
Anonymous
7/18/2025, 8:09:54 PM No.105948932
fcCQMIh
fcCQMIh
md5: 3410e700eb2e25c9357e05ca44b7a02f๐Ÿ”
>>105947872
some compilers can understand when you're adding one
Replies: >>105953985
Anonymous
7/18/2025, 8:12:26 PM No.105948957
What about n *= m, n /= m, n%= m, etc?
Replies: >>105948961
Anonymous
7/18/2025, 8:13:16 PM No.105948961
>>105948957
What about them?
Anonymous
7/18/2025, 8:18:03 PM No.105948996
>>105947817 (OP)

(setq n(1+ n))
Replies: >>105954033
Anonymous
7/18/2025, 8:22:50 PM No.105949042
>>105947848
I have never used ++n in my career
Replies: >>105949167 >>105955269
Anonymous
7/18/2025, 8:25:23 PM No.105949063
Why do useless threads like this are the ones that receives replies?
Replies: >>105949091 >>105949288 >>105956146
Anonymous
7/18/2025, 8:27:44 PM No.105949091
DID_YOU_JUST_FLIP_MY_SWITCH_thumb.jpg
DID_YOU_JUST_FLIP_MY_SWITCH_thumb.jpg
md5: fb0afa7207447e98d05387f5dbd4e15f๐Ÿ”
>>105949063
It's just a typical skub thread. Ni/g/gers love to bicker about pointless shit.
Anonymous
7/18/2025, 8:35:24 PM No.105949167
>>105949042
it's better for stl iterators. however, in recent years the main compilers will detect your skin color and fix it in the assembly
Anonymous
7/18/2025, 8:50:59 PM No.105949288
>>105949063
It's kind of fun. Entry level, but you still need to know something to participate. Should we just do another brand warz or ai thread instead?
Replies: >>105950153
Anonymous
7/18/2025, 9:00:42 PM No.105949379
>>105947817 (OP)
>post-increment
>post-
Anonymous
7/18/2025, 10:25:13 PM No.105950153
>>105949288
It's the same pointless tribalism, did anons forgot how to normally talk to each other?
Anonymous
7/18/2025, 10:44:51 PM No.105950324
>>105948736
>:=
ngmi
Anonymous
7/18/2025, 10:51:10 PM No.105950370
its so u can do stuff like auto x = *ptr++. or auto x = a[ind++]. saves an extra line. ++x will increment before so say int a = 5; int b = ++a; they will both be 6. however if int a = 5; int b = a++ b will be 5 and a will be 6. n+=1 is the same as n = n + 1, so it cannot be used in expressions.
Replies: >>105950424
Anonymous
7/18/2025, 10:55:45 PM No.105950424
>>105950370
>saves an extra line
Peak mathcuck mentality, saving lines over being easy to read.
Replies: >>105950805 >>105952596
Anonymous
7/18/2025, 11:30:26 PM No.105950805
>>105950424
you mean your machine doesnt have a finite capacity of newline characters?
Replies: >>105950932
Anonymous
7/18/2025, 11:40:58 PM No.105950911
>>105947817 (OP)
Judging by the fact that literally nobody knows what this shit does without looking up the standard it probably shouldn't exist.
Anonymous
7/18/2025, 11:43:11 PM No.105950932
>>105950805
Yeah, for all intensive purposes, that's right.
Replies: >>105951004
Anonymous
7/18/2025, 11:51:58 PM No.105951004
>>105950932
I hole-hardedly agree, but allow me to play doubles advocate here for a moment. For all intensive purposes I think you are wrong. In an age where false morals are a diamond dozen, true virtues are a blessing in the skies. We often put our false morality on a petal stool like a bunch of pre-Madonnas, but you all seem to be taking something very valuable for granite. So I ask of you to mustard up all the strength you can because it is a doggy dog world out there. Although there is some merit to what you are saying it seems like you have a huge ship on your shoulder. In your argument you seem to throw everything in but the kids Nsync, and even though you are having a feel day with this I am here to bring you back into reality. I have a sick sense when it comes to these types of things. It is almost spooky, because I cannot turn a blonde eye to these glaring flaws in your rhetoric. I have zero taller ants when it comes to people spouting out hate in the name of moral righteousness. You just need to remember what comes around is all around, and when supply and command fails you will be the first to go. Make my words, when you get down to brass stacks it doesn't take rocket appliances to get two birds stoned at once. It's clear who makes the pants in this relationship, and sometimes you just have to swallow your prize and accept the facts. You might have to come to this conclusion through denial and error but I swear on my mother's mating name that when you put the petal to the medal you will pass with flying carpets like itโ€™s a peach of cake.
Replies: >>105952002
Anonymous
7/18/2025, 11:57:33 PM No.105951046
1751370159027995
1751370159027995
md5: c56fb61152ab39250c7216eaa49aacc1๐Ÿ”
>*(c+=1)
Anonymous
7/18/2025, 11:58:04 PM No.105951054
>>105948330
Hello sar are you crazy? Fuck you bloody bastard bitch. The correct syntax is:

Integer n;
String n2 = "0";
String n3 = "1";
n = Integer.parseInt(n2) + Integer.parseInt(n3);
Anonymous
7/19/2025, 12:12:28 AM No.105951183
>>105947817 (OP)
We need new features in C++ such that we can redefine operators.
#define n++ n+=1
Anonymous
7/19/2025, 1:38:49 AM No.105951793
>>105948431
But code doesn't smell. I can imagine any smell I want when I look at code.
Replies: >>105951915 >>105952082
Anonymous
7/19/2025, 1:43:38 AM No.105951829
>>105947872
> some?
Almost all.
Pascal:
succ(n)
Anonymous
7/19/2025, 1:45:25 AM No.105951843
>>105947848
++n is 1 = 1 + n
n++ is n = n + 1
Anonymous
7/19/2025, 1:46:44 AM No.105951855
>>105947891
cniles have lost their rights to make fun of rustroons
Replies: >>105951984
Anonymous
7/19/2025, 1:56:30 AM No.105951915
>>105951793
but you smell the jeets.
in the office on the other side of the building.
3 floors away.
Anonymous
7/19/2025, 2:04:47 AM No.105951978
>>105948470
i = 1; // optimisation: assumes that i is zero initially. should be true most of the time.
Anonymous
7/19/2025, 2:06:00 AM No.105951984
>>105951855
They seem to be getting more rights over rust developerโ€™s own bodies.
Anonymous
7/19/2025, 2:08:36 AM No.105952002
>>105951004
I prefer the rotational velocidensity pasta desu
Anonymous
7/19/2025, 2:10:43 AM No.105952007
>>105948476
sounds more like something Boomer Junion Wasperson III (freemason 2nd degree) would say
Replies: >>105952014
Anonymous
7/19/2025, 2:11:44 AM No.105952014
>>105952007
*Junior
Anonymous
7/19/2025, 2:23:09 AM No.105952082
>>105951793
>>But code doesn't smell
>bing "code smell"
>ten trillion hits
Replies: >>105952313
Anonymous
7/19/2025, 2:26:34 AM No.105952108
>>105947817 (OP)
inc n
Anonymous
7/19/2025, 2:27:09 AM No.105952111
professional_retard
professional_retard
md5: 29e1df8d6671004891f2b254611f58a0๐Ÿ”
>I am so much smarter than any compiler
>I write ++i instead of i++ in for loops because it generates 1.2 fewer instructions
literally all of you
Replies: >>105952116 >>105952587
Anonymous
7/19/2025, 2:27:47 AM No.105952116
>>105952111
*-O3's your path*
Anonymous
7/19/2025, 2:58:48 AM No.105952313
>>105952082
If that's how you judge what's real you're going to be a targeted individual soon.
Anonymous
7/19/2025, 3:30:07 AM No.105952552
>>105947903
while loops are bloat, just use tail recursion.
Replies: >>105952655 >>105954070
Anonymous
7/19/2025, 3:36:16 AM No.105952587
>>105952111
The compiler is not omniscient.
Replies: >>105955455
Anonymous
7/19/2025, 3:39:14 AM No.105952596
>>105950424
i agree that it's pointless and stupid, but if you can't automatically parse ++ and += as the same unconsciously you have bigger problems
Replies: >>105952627
Anonymous
7/19/2025, 3:46:30 AM No.105952627
>>105952596
I like writing i++ a lot more than i += 1. I just hate reading code where they heavily rely on juggling the return values from ++ shit everywhere just so they can save a line.
Anonymous
7/19/2025, 3:49:09 AM No.105952640
1734385132468389_thumb.jpg
1734385132468389_thumb.jpg
md5: 5aebe3b75f474017bcfad600093a836c๐Ÿ”
>>105948431
Imagine the smell.
Anonymous
7/19/2025, 3:50:42 AM No.105952655
>>105952552
it all ends up as jumps anyway
Replies: >>105952925
Anonymous
7/19/2025, 3:52:31 AM No.105952669
>>105948431
Yes, and it's not code that stinks good
Anonymous
7/19/2025, 3:55:05 AM No.105952689
>>105947817 (OP)
Postfix operators give you (non-atomic) exchange semantics. `+=` does not.
Anonymous
7/19/2025, 4:37:37 AM No.105952915
>>105948391
I hate this because it sounds exactly like something some smug asshole high on his own farts would put in a company style guide and lecture you about.
Replies: >>105953754
Anonymous
7/19/2025, 4:39:12 AM No.105952925
>>105952655
not on my watch
https://github.com/xoreaxeaxeax/movfuscator
Anonymous
7/19/2025, 4:48:03 AM No.105952994
>>105948187
Based. Now what is it in RISC-V64
Anonymous
7/19/2025, 6:57:40 AM No.105953754
>>105952915
imagine not using clang-tidy in 2025
Anonymous
7/19/2025, 7:35:47 AM No.105953939
Is it weird that I prefer
nCount++;
SomeFunction(sTest, nCount, nLimit, fCharge);
over
SomeFunction(sTest, ++nCount, nLimit, fCharge);
I feel like the first is more readable
Replies: >>105953944
Anonymous
7/19/2025, 7:37:25 AM No.105953944
>>105953939
preincrements are confusing. Only post increments should be used.
Anonymous
7/19/2025, 7:45:15 AM No.105953985
1681807688619
1681807688619
md5: e3e5457d9f06ad216bb81f6a60abc9ce๐Ÿ”
>>105948932
Replies: >>105954229 >>105954352 >>105955393
Anonymous
7/19/2025, 7:55:06 AM No.105954033
>>105948996
while (++moron_counter < nigger_var--) { trashbin(++shitposters); }
or
moron_counter += 1;
while (moron_counter < nigger_var) {
shitposters += 1;
trashbin(shitposters);
nigger_var -= 1;
moron_counter += 1;
}
Anonymous
7/19/2025, 8:02:31 AM No.105954070
>>105952552
you're going to overflow the stack tranny
Replies: >>105955490 >>105956552
Anonymous
7/19/2025, 8:03:57 AM No.105954075
1284157967346
1284157967346
md5: 85ca102f979be8ce442d0d7f025ff0fc๐Ÿ”
>>105948422
>>105948497
>several hours later
>this retardation is still going
Anonymous
7/19/2025, 8:27:25 AM No.105954191
>>105947872
Yep, and on x86_64 it's unused. Even if you use i++, it will get replaced with an ADD instruction. INC is no faster than an ADD, but doesn't set RFLAGS
Anonymous
7/19/2025, 8:35:08 AM No.105954229
>>105953985
holy fuck stay away from computers, for the love of god
Anonymous
7/19/2025, 8:45:54 AM No.105954276
>>105947817 (OP)
As a physicist I just say that literally everything is better than n=n+1. At least ++ and += have no meaning in mathematics.
Replies: >>105955337
Anonymous
7/19/2025, 9:04:27 AM No.105954352
>>105953985
Why do you expect code that has undefined behavior to not be broken by compiler optimisation? And bringing TCC to the mix isn't even fair because no optimisation.
Anonymous
7/19/2025, 11:41:24 AM No.105955166
What does this function return?
int foo (void) {
int n = 0;
return ++n + n++;
}
You should be able to solve this.
Replies: >>105955259 >>105955527
Anonymous
7/19/2025, 11:51:20 AM No.105955224
>>105947848
>the utter state of the replies
cniles btfo
Anonymous
7/19/2025, 11:55:45 AM No.105955259
>>105955166
Is it 1?
I remember I had this issue a while ago where I returned n++, but it didn't return the incremented value.
Replies: >>105955419
Anonymous
7/19/2025, 11:57:04 AM No.105955269
>>105949042
You use it for iterators, which are not required to support it++ as operation.
Anonymous
7/19/2025, 12:10:26 PM No.105955337
>>105954276
> n = n + 1
> n - n = 1
>0 = 1
>the universe implodes
Anonymous
7/19/2025, 12:20:10 PM No.105955387
>>105947817 (OP)
I use it only for for-loop
Anonymous
7/19/2025, 12:21:51 PM No.105955393
>>105953985
>look at me, I don't know C
https://www.gnu.org/software/c-intro-and-ref/manual/html_node/Signed-Overflow.html
Anonymous
7/19/2025, 12:25:26 PM No.105955419
2025-07-19-12:27:30
2025-07-19-12:27:30
md5: 2c842119dbbc7eb3e2bec2f28835dcc5๐Ÿ”
>>105955259
it's undefined behavior. any compiler is free to do whatever it wants with that expression.
In fact, gcc and clang will warn you if you try to do that.
Replies: >>105955527
Anonymous
7/19/2025, 12:31:54 PM No.105955455
>>105952587
all compilers will emit the same instructions for i++ and ++i unless you explicitly use the rvalue from i++. Notable exceptions being the first C (ansi C) compiler which didn't have optimizations and would emit fewer insn for ++i.
https://godbolt.org/z/WWrxjaTnq
Anonymous
7/19/2025, 12:37:50 PM No.105955490
>>105954070
>tail recursion
>will overflow the stack
chatgpt levels of confidently wrong
Replies: >>105955545
Anonymous
7/19/2025, 12:45:16 PM No.105955527
>>105955166
>>105955419
it will always return 2

if ++n evaluates first it, returns 1 and n is now 1
then n++ evaluates second, returning 1 and n is 2
1 + 1 = 2

if n++ evaluates first, it returns 0 and n is now 1
then ++n evaluates, returning 2 and n is now 2
0 + 2 = 2
Replies: >>105955540
Anonymous
7/19/2025, 12:47:51 PM No.105955540
file
file
md5: 435648b4101b7c3e3f9f9d44c2c1a138๐Ÿ”
>>105955527
And yet
https://godbolt.org/z/1vMEEzqzW
Replies: >>105955564
Anonymous
7/19/2025, 12:48:58 PM No.105955545
>>105955490
I sure am glad to live in a world where tail call optimization is consistently implemented by all languages
Anonymous
7/19/2025, 12:51:43 PM No.105955564
>>105955540
damn
Anonymous
7/19/2025, 2:19:20 PM No.105956146
1751600318466466
1751600318466466
md5: 58369fdefa1194a905bdd73f00475bad๐Ÿ”
>>105949063
As opposed to what threads? Your shitty question that could be answered by an LLM and belongs in /sqt/? The trillionth brand war thread? Maybe the excuse of a thread to post weebshit?
Anonymous
7/19/2025, 2:29:20 PM No.105956214
>>105947817 (OP)
are you american by any chance
Anonymous
7/19/2025, 3:13:16 PM No.105956552
>>105954070
Are you genuinely retarded, or just pretending to be stupid for the lulz?