Add support for struct in M_AS_TYPE
This commit is contained in:
1 parent
06b79a6caa
commit
9aa08bfc59
1 file changed
+4
-3
@@ -1952,11 +1952,12 @@ M_PARSE_DEFAULT_TYPE_DEF(m_core_parse_ldouble, long double, strtold, )
|
|||||||
This macro overcomes this limitation by returning :
|
This macro overcomes this limitation by returning :
|
||||||
* either the input 'x' if it is of type 'type',
|
* either the input 'x' if it is of type 'type',
|
||||||
* or the value 0 view as a type 'type'.
|
* or the value 0 view as a type 'type'.
|
||||||
Only works with pointers, integer or floats.
|
Only works with pointers, integer, floats or structures.
|
||||||
Using (x)+0 will perform integer promotions, and prevent the macro
|
NOTE: Using (x)+0 will perform integer promotions, and prevent the macro
|
||||||
to be used for small types (bool, char, short).
|
to be used for small types (bool, char, short).
|
||||||
|
NOTE: Not compatible with C++.
|
||||||
*/
|
*/
|
||||||
#define M_AS_TYPE(type, x) _Generic(((void)0,(x)), type: (x), default: (type) 0)
|
#define M_AS_TYPE(type, x) _Generic(((void)0,(x)), type: (x), default: (type) {0})
|
||||||
|
|
||||||
/* Perform a C conditional operator with the following restriction:
|
/* Perform a C conditional operator with the following restriction:
|
||||||
* - cond shall be a compile time constant.
|
* - cond shall be a compile time constant.
|
||||||
|
|||||||
Reference in new issue
Block a user