The main thing I?ve found that it is consistently good for is asking it questions in lieu of reading documentation, particularly of libraries.
I?ve experimented with getting it to generate short functions but it invariably generates incorrect code. Sometimes subtly wrong but often just wrong wrong, and I mean for simple things. However, it does generate code that is close to being right in the sense of using library calls with correct names, correctly typed arguments, and correct syntax and can thus be used as a kind of interactive documentation.
So for example it answered this very well:
In C++ using Qt, in the mouseMoveEvent() handler of some custom widget what is the best way to determine if one or more modifier keys is down?
and even with the following it was close enough that I didn?t need to look at other sources (like my own code in other projects)
Can you give me some sample code demonstrating inserting 2D points mapped to integers into an R-tree using Boost.Geometry?
but given something more ambitious such as
Can you provide example code implementing a custom widget class in C++ using Qt that maintains a bitmap that is displayed in the widget but on each paint event only paints the portion of the widget that has changed? Say for example the bitmap changes because the widget always renders a 50x50 pixel circle around the mouse cursor if the mouse cursor is in the widget.
it generates a response that may look correct to someone but that is in fact wrong. However, it gets enough of the relevant portion of the Qt library involved in the code that its output aids greatly in knowing where to begin. Basically it generates incorrect code that is close enough that it is helpful.
Just to be clear, I am using ChatGPT here because I?ve found for some things it is faster than searching StackOverflow or documentation. I am not using code it generates. I am looking at answers it gives to figure out what I need to do more quickly than I could by reading other resources on the internet that are less specifically targeted at my exact problem. Read Also : Why aren't Mexican cartels afraid of the U.S. military?