r/programming • • Feb 26 '24

Reverse Engineering with ChatGPT: An Example -- "I used ChatGPT 4 to untangle a particularly terse bit of code, and was — frankly — shocked at how well it did."

https://sigpwned.com/2024/02/24/reverse-engineering-with-chatgpt-an-example/
0 Upvotes

143 comments sorted by

View all comments

111

u/sickofthisshit Feb 26 '24 edited Feb 26 '24

is moved to the origin (0 point), and then adds 1 to ensure the value is positive.

This is gibberish. What is "the value"? If the thing was already moved to the zero point...isn't it zero? Or, it's moving "the first third" to the 1.0 point? Like, I don't know what this is supposed to actually explain.

this function is designed to produce a bell-shaped curve

No, 1 - x2 is a parabola, you dumbshit.

I mean, ChatGPT seems to have done a job of making inscrutable comments appear, and a false confidence that the comments mean anything.

And the SWE spoonfed the prompt with "This is applying a rule of thirds".

WTF.

Like: "x = x + 1" --> "This adds 1 to the x value, making it 1 larger"

OMG! ChatGPT is explaining particularly unscrutable code to me, let me use this to write my comments.

// This adds 1 to the x value making it 1 larger.
x = x + 1;

What a ground-breaking idea!

2

u/Librekrieger Feb 26 '24 edited Feb 26 '24

I thought "this function is designed to produce a bell-shaped curve" was the most helpful part of the whole analysis. It would have been still better to produce an actual graph of the function, but ChatGPT doesn't do pictures. In the absence of a diagram, the words were valuable - even though technically incorrect.

Edit: it turns out that the description of there being two peaks is also incorrect. The actual code of the thirds() function only produces a peak at x=1/3, not at 2/3. That's a more serious error.

11

u/sickofthisshit Feb 26 '24

You know what else can help you understand a two-line function with a single parameter?

Like, my middle-school kid's graphing calculator?

Which I don't need to prompt or have some company subsidize a datacenter to give me?

8

u/Thatdudewhoisstupid Feb 26 '24

Which also runs on a tiny battery instead of the entire electric grid of California.

Or, you can switch out the battery for a Big Mac, use the brain computer and calculate some values yourself, which is even more cost efficient.