Question Details

No question body available.

Tags

c

Answers (4)

March 7, 2026 Score: 2 Rep: 411,903 Quality: Low Completeness: 0%

This isn't an open-ended discussion type of question, and shouldn't have been posted as such. Please delete this and post as a normal question.

March 7, 2026 Score: 2 Rep: 72,627 Quality: Low Completeness: 30%

As it is best practice question:

The best practice is to avoid _Genetric if you need function ovetloading - learn C++

March 7, 2026 Score: 1 Rep: 44,208 Quality: Low Completeness: 0%

Please post a compilable [mre]. I would like to propose a solution based on the shown code, but I don't want to fix it.

March 7, 2026 Score: 1 Rep: 60,688 Quality: Low Completeness: 50%

Just leave out the default branch and the compiler will give you an error message about not matching with any of the otherwise-listed types.

I wouldn't worry about trying to print a custom compiler failure message. This isn't a message aimed at end users. This is a message aimed at programmers. A programmer will be able to handle a message that isn't as pretty as it could be. Even just being directed at the offending _Generic should be enough to make a programmer understand what's wrong.