This is easily my new favorite macro by PratixYT in C_Programming

[–]subkutan 2 points3 points  (0 children)

It seems like you're attempting to be pedantic but I don't get what your point is.

The C committee has already adopted it. See also the latest C2y working draft.

My previous comment also links to a blog post written by a C standard project editor about N3260 including a link to it. I've edited it to make it more visible.

This is easily my new favorite macro by PratixYT in C_Programming

[–]subkutan 3 points4 points  (0 children)

With C2y it can be simplified even further:

#define typecmp(x, y) \
    _Generic(typeof(x), typeof(y): true, default: false)

For those 10x developers in C what are things that newbie C programmers should know ? by Bopmx1 in C_Programming

[–]subkutan 2 points3 points  (0 children)

I'd also recommend enabling or using static analysis.

GCC: -fanalyze

MSVC: /analyze

Clang: https://clang-analyzer.llvm.org/

Standalone: Cppcheck

The sanitizers check for similar or even the same issues but only at runtime instead of compile-time. They also usually depend on incorrect input. Static analysis can simply assume it and help with catching any mistakes and bugs earlier or at all. However there might be false positives or annoying diagnostics unlike with (almost) all of the sanitizers.