A week or so ago I needed to convince chatgpt that following code will indeed initialize x values in struct
struct MyStruct
{
int x = 5;
};
...
MyStruct myStructs[100];
It was insisting very passionately that you need MyStruct myStructs[100] = {}; instead.I even showed msvc assembly output and pointed to the place where it is looping & assigning all x values and then it started hallucinating about msvc not conforming the standards. Then I did it for gcc and it said the same. It was surreal how strongly it believed it was correct.
LLM's don't have beliefs, so "convincing" them of this or that is a a waste of your time. The way to handle such cases is to start anew with a clean context and just add your insight to the prompt so that it lands on the right track from the beginning. Remember these models are ultimately just next-token predictors and anthropomorphizing them will invariably lead to suboptimal interactions.
That is not even valid C code, so you would have to seriously convince me, too.
What makes it invalid is "= 5", and lack of "struct" before "MyStruct" (could have used typedef).
It is a c++ code.