alejandro@kbin.socialtoProgramming@kbin.social•[C question] Best way to change features of the program at compile time: #if((n)def) or if (const)?
4·
1 year agoAnother way would be to keep the proprietary code in their own compilation units, and replace them with a dummy/stub implementation from your build system at config time (e.g. CMake option + if() statement). One benefit to this is that you don’t have to litter your codebase with a bunch of preprocessor directives.
There’s no “better” way though, just pick the one you find easier to manage.
The most success I’ve had with AI assisted programming was when I found myself having to work with HTML in Python for the first time, and I used ChatGPT to generate sample code for specific things I wanted to do with lxml. It was much, much faster than reading through the crappy docs to properly learn the API.
Unfortunately, I haven’t been able to replicate that success with other projects. Unless it’s some low hanging fruit/popular library like lxml, ChatGPT tends to hallucinate APIs that don’t exist.
EDIT: also, I’ve tried using AI code generators that integrate into your IDE, but never found them to be that useful. Something like clangd is more consistently helpful, and actually guaranteed to be correct.