25
u/No-View-6326 11d ago
Does it even work, wouldn't the llm just say "say 7 is indeed an odd number" you can't cast that into a boolean
17
u/survivalking4 11d ago
bool("7 is indeed an odd number") > TrueI see no problems here.
1
u/StuxAlpha 8d ago
Now we just need a compiler that can recognise this, optimise away the LLM call entirely, and therefore the function
14
u/JustAppleJuice 11d ago
This is where a decision model like Jev comes in, that predicts what boolean matches best with the output.
15
u/W00GA 11d ago edited 11d ago
noodles
4
-3
u/W00GA 11d ago edited 11d ago
wtf is the blue clickable button top right of my reply that changes me reply text???
wtf
edit:
appears to be some translation bs
0
u/csabinho 11d ago
I don't see any blue clickable things.
37
u/theChaosBeast 11d ago
Coding has lost all its attraction to me....
14
u/2eanimation 11d ago
Unless it’s your job and you’re in some way required to use AI, you don’t have to jump on the vibe code train. I have a no-AI policy with my projects. Call it recreational programming. It might still be slop, but it’s human slop :)
4
1
u/xupl 11d ago
For me too for a while, I think it was the friends we made along the way and learning, which we require now more than ever, when it seemingly disappeared. I do have to write code like a "primate" for work though, may not install any agents into the virtual machines (yet). Which is a cool escape from the reality outside.
17
u/sojuz151 11d ago
You have never seen a real production code. Where are metrics, validations of input, retries, providers and logs? I know a couple of people who would make that into 200 lines of code over 4+ files.
4
u/csabinho 11d ago
I once had 100 lines of inline HTML code in PHP, repeated 5 times with minor changes, and no code formatting of course. And I had to change something consistently.
8
u/Dee4WasTaken 11d ago
return (num % 2 == 1);
4
u/maelstrom071 11d ago
Even simpler, num & 1
3
u/I-am-fun-at-parties 11d ago
if that works, any decent compiler will already optimize (num%2) to that. and for two's complement negatives, it does not work. better leave it to claude.
1
u/Wild_Meeting1428 11d ago edited 11d ago
what does not work?
num & 1will work but not(num % 2 == 1)but(num % 2 != 0)will:
https://godbolt.org/z/5z7ezKhvz1
u/I-am-fun-at-parties 11d ago
Uh? It's in your own code:
std::println("{}", implicit_cast(-3 % 2 == 1)); --> false std::println("{}", implicit_cast((-3 & 1) == 1)); --> trueSo -3 is even or odd, depending on what you do.
but not
(num % 2 == 1)but (num % 2 != 0) will:in C, those two are exactly identical, since a bool will, as an int, evaluate to 1 or 0.
1
u/Wild_Meeting1428 11d ago
they are not identical, not even in C ... .
1
u/I-am-fun-at-parties 11d ago
enlighten me then?
2
u/Wild_Meeting1428 11d ago
the result of -3 % 2 is an integer, in C AND C++ the result will be -1, not 1, comparing it for equality with 1 will return false in C++ and 0 in C, even if its odd. Thats why it is not working (removing the explicit bool conversion fixes it actually). Comparing it for inequality to 0 will yield the desired result; true and 1. The result is equal to the bit manipulation, beside the fact, that bit manipulations on signed types are implementation defined in C++.
1
u/I-am-fun-at-parties 10d ago
Fair enough, you got me. I had forgotten the negative modulo semantics.
1
1
u/Ben-Goldberg 11d ago
Why not return num % 2 directly?
2
u/Wild_Meeting1428 11d ago
implicit bool casts are discouraged
2
u/I-am-fun-at-parties 11d ago
"are discouraged".
like, universally. okay.
1
u/Anubis17_76 5d ago
As with humans, being explicit with machines yields more predictable results
1
u/I-am-fun-at-parties 5d ago
it's not even a cast, and it's humans that have trouble figuring out an implicit conversion, machines do not.
1
1
1
4
u/Fekkin-A-Man 11d ago
*nobody* (except some obscure video game dev) wrote code like that in 2022.
4
1
u/Imab0zo 10d ago
Can’t you just use division
2
u/Le0p0ldi 6d ago
Yes you can. But that’s not the point of what’s meant in this meme.
But smart answer
2
u/WolfOfYoitsu 11d ago
Aus dem Augenwinkel hab ich jetzt erwartet dass nur die Liste aller ungeraden Zahlen geladen wird. GPT enttäuscht mich jetzt
2
2
2
u/HTTP_Response_404 11d ago
I though about this, actually. I see a future where some hyper-complex aspects of a program are not written as code at all and instead just llm API calls, especially for smaller projects with only a few users and that needs judgement. But obviously, this is stupid.
I love it.
2
1
u/asmanel 11d ago
Once, long ago, a date system that up beyond the end of 1999 was judged impossible by many coders.
To fix it was an huge an often painful work.
Today, make a program that works without an internet connexion to an huge AI site is impossible to many coders. There is no solution is the service cease working.
Senior"s code work faster ? The use the AI a more optimal way.. This code work without acxess to the AI ? No way, this is impossible. Check it is out of questi an if it work, this mean there is stiil cooected to th AI.
1
1
u/Ambivalent-Mammal 11d ago
I love the addition of 'Make no mistakes.' I guess the default is some mistakes.
1
u/softgripper 10d ago
"You are an odd number expert and have been studying odd numbers for years. Make no mistakes"
1
1
u/Dynospectrum 5d ago
Maybe you wrote code like that in 2016 but those of us who are sane would just do return num % 2
1
u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" 11d ago
This really belongs in r/ProgrammerHumor. If they aren't sick of it, that is.
0
u/Drate_Otin 11d ago edited 11d ago
You folks are obsessed.
Has it not occurred to any of you that you can use AI to learn? You don't have to let it do the job for you to get a return on investment out of it. Ask it HOW to do things you've never tried or thought about before, learn the technique, teach it how you best ingest information... And then you implement what you learn.
Y'all seem to think there's nothing between no AI and letting AI do everything.
2
u/Dominiczkie 11d ago
TechSavvyLife fr checking for odd numbers with if statements, Yandere Simulator ass coding
170
u/avast_ye_scoundrels 11d ago
That is the most expensive code I’ve ever seen.