this post was submitted on 18 Oct 2024
157 points (98.8% liked)

Programming Horror

1854 readers
168 users here now

Welcome to Programming Horror!

This is a place to share strange or terrible code you come across.

For more general memes about programming there's also Programmer Humor.

Looking for mods. If youre interested in moderating the community feel free to dm @[email protected]

Rules

Credits

founded 1 year ago
MODERATORS
 
top 13 comments
sorted by: hot top controversial new old
[–] [email protected] 17 points 20 hours ago

knowing GPT users, this is probably not satire.

[–] [email protected] 4 points 15 hours ago

Someone needs to put this in DreamBerd

[–] [email protected] 33 points 1 day ago (2 children)

From my experience with ChatGPT:

  1. It will NEVER consistently give you only the value in the response. It will always eventually add in some introductory text like it’s talking to a human. No matter how many times I tried to get it to just give me back the answer alone, it never consistently did.
  2. ChatGPT is terrible with numbers. It can’t count, do math, none of that. So asking it to do byte math is asking for a world of hurt.

If this isn’t joke code, that is scary.

[–] [email protected] 39 points 1 day ago (1 children)

I refuse to believe you are not certain this is a joke

[–] [email protected] 12 points 1 day ago (1 children)

I know it is, but I’ve also seen people try to use ChatGPT for similar things as a serious endeavor.

[–] [email protected] 15 points 23 hours ago (2 children)
[–] [email protected] 2 points 15 hours ago

how is it different from a calculator or say a Python REPL? i'm asking b/c i'm too old to try out young folks inefficiently engineered "solutions".

[–] [email protected] 5 points 23 hours ago

Neat! Never seen this one before.

[–] [email protected] 2 points 23 hours ago

For 1, that's why you say "Format your answer in this exact sentence: The number of bytes required (rounded up) is exactly # bytes., where # is the number of bytes." And then regex for that sentence. What could go wrong?

Also, it can do math somewhat consistently if you let it show its work, but I still wouldn't rely on it as a cog in code execution. It's not nearly reliable enough for that.

[–] Object 34 points 1 day ago

Money generator for bug bounty hunters

[–] [email protected] 10 points 1 day ago (1 children)

You don't need to cast the return value from malloc.

[–] [email protected] 5 points 23 hours ago

True. Although given how easy it is to cast void pointers to the wrong damn thing, it would be nice if you did, makes refactoring much easier. Makes me appreciate std::any all the more.

[–] [email protected] 5 points 1 day ago