News for hackers. Stuff that matters.
Re:Tell HN: C Experts Panel – Ask us anything about C by DSMan195276 on Tuesday April 14, 2020 @10:35AM (#22866491)
The straight-forward approach is just two functions, one with `const` and one without (You can make one of them `static inline` around the other and do some casting to avoid implementing the same thing twice).

With that, selecting the correct function via `_Generic` should be possible (`_Generic` is a bit fiddly, but matching on `const char * ` and `char * ` should work just fine for this), and for the most part this is actually an/the intended use case for `_Generic` - it's basically the same as the type-generic math functions, more or less.

There are no comments on this comment yet.