42 points

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.

permalink
report
reply
47 points

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

permalink
report
parent
reply
18 points

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

permalink
report
parent
reply
20 points

Friendly reminder that CalcGPT exists

permalink
report
parent
reply
2 points

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.

permalink
report
parent
reply
1 point
*

I know a guy who was working on something like this, they just had the call to the model loop until the response met whatever criteria the code needed (e.g. one single number, a specifically formatted table, viable code, etc) or exit after a number of failed attempts. That seemed to work pretty well, it might mess up from time to time but it’s unlikely to (with the right prompt) do so repeatedly when asked again.

permalink
report
parent
reply
1 point

I’m currently a guy working on something like this ! It’s even simpler as you can have structured output on the chatgpt API. Basically you give it a JSON schema and it’s guaranteed to respond with JSON that validates against that schema. Spent a couple weeks hacking at it and i’m positively impressed, I have had clean JSON 100% of the time, and the data extraction is pretty reliable too.

The tooling is actually reaching a sweet spot right now where it makes sense to integrate LLMs in production code (if the use case makes sense and you haven’t just shoe-horned it in for the hype).

permalink
report
parent
reply
0 points

Fair play to Open AI - I still think LLMs are overhyped, but they’re moving things along constantly in impressive ways.

permalink
report
parent
reply
-1 points

This works well too, and with many different models: https://github.com/guardrails-ai/guardrails

permalink
report
parent
reply
40 points

Money generator for bug bounty hunters

permalink
report
reply
26 points

knowing GPT users, this is probably not satire.

permalink
report
reply
11 points

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

permalink
report
reply
8 points

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.

permalink
report
parent
reply
1 point
*

Void pointer should be avoided anyways. Even I find them rare and I mostly work in embedded RTOS

permalink
report
parent
reply
1 point

you do in c++, no?

permalink
report
parent
reply
2 points

In c++ you should use new.

permalink
report
parent
reply
1 point

that is besides the point. You can still call malloc, it will still return void*, and it would still reqoire casting in c++

permalink
report
parent
reply
1 point
*

This isn’t malloc though. I have to assume the cast is because the user has experience with the output from an LLM being untrustworthy.

permalink
report
parent
reply
5 points

Hey, best of luck figuring that out:

https://www.learnc.net/c-tutorial/c-integer/

permalink
report
reply

Programming Horror

!programming_horror@programming.dev

Create post

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 @Ategon@programming.dev

Rules

  • Keep content in english
  • No advertisements (this includes both code in advertisements and advertisement in posts)
  • No generated code (a person has to have made it)

Credits

  • Icon base made by Lorc under CC BY 3.0 with modifications to add a gradient

Community stats

  • 256

    Monthly active users

  • 33

    Posts

  • 272

    Comments

Community moderators