▲ | SV_BubbleTime 5 days ago | |
“I need a C class that has a constructor for a tuple” I would hope Claude would be like “Hold on man…” | ||
▲ | qayxc 5 days ago | parent | next [-] | |
Hm. That was interesting, so I ran it as prompt to Qwen3-Coder (which I run locally). It spat out a bunch of C functions together with a C struct and commented:
Seems to be a common enough request to be present in the model's training data :D Even the code looked fine, apart from being a very naive and thus slow implementation. | ||
▲ | codedokode 5 days ago | parent | prev | next [-] | |
I asked ChatGPT to make a system of macros that would generate a struct with given fields (for example: int a, bool b, char *c) and a function that would print the struct contents. Instead of refusing it started inventing recursive macros that were never going to work. It seems LLMs are especially bad with C macros. If you have access to state-of-art coding assistants, try asking this. You can additionally add a requirement to generate a destructor function (that would free dynamically-allocated fields). | ||
▲ | petesergeant 5 days ago | parent | prev [-] | |
> I need a C class that has a constructor for a tuple | I'll create a simple C++ class with a constructor that takes a tuple. Here's an example... > nah C | C doesn't have classes or constructors - those are C++ features. In C, you would use a struct and create an initialization function. Here's how you'd handle a tuple-like structure: |