cppreference shows these prototypes for strchr()
:
char *strchr( const char *str, int ch ); (1)
/*QChar*/ *strchr( /*QChar*/ *str, int ch ); (2) (since C23)
and offers this explanation for the second version:
Type-generic function equivalent to (1). Let T be an unqualified character object type.
- If
str
is of typeconst T*
, the return type isconst char*
.- Otherwise, if
str
is of typeT*
, the return type ischar*
.- Otherwise, the behavior is undefined.
What is this QChar*
? Is it a new type?
If so, does GCC and/or Clang support it already? Can I use it in my own application code?
strchr()
and some other functions with const or non const char pointers and get the same type back.