Home > Enterprise >  Can _Generic match on string of type?
Can _Generic match on string of type?

Time:12-05

Example use-case, do a thing for all types that contain the string "int". More precise, have a struct Point in different versions as Point__alloca or Point__boehm, and then a macro new that switches on that name. Hm, maybe macro stringification could do that?

CodePudding user response:

Standard C supports only very limited introspection (examination of the program by itself) and nothing that would discern whether a type name contained particular characters or any ability to enumerate “all types” at all, let alone all types matching a criterion. In short, there is no support for the feature you request.

  • Related