Generic o(X) is used to construct Object from several types. But GCC don't expands to typedef types.
warning: passing argument 1 of ‘oBytes’ from incompatible pointer type [-Wincompatible-pointer-types]
68 | Object ovi = o(vi);
| ^~
| |
| HashTable {aka struct _HashTable *}
../cedata.h:13:43: note: in definition of macro ‘o’
13 | char : oBytes( X , 1),
|
_Generic definition of o(x):
#define o( X ) _Generic ((X),
char : oBytes( X , 1),
char * : oNewFrom(STRING, X),
unsigned char * : oNewFrom(STRING, X),
int : oNewFrom(INT, X),
float : oNewFrom(FLOAT, X),
short : oNewFrom(SHORT, X),
HashTable : oNewFrom(HASHTABLE,X),
List : oNewFrom(LIST, X),
default : oNew()
)
All oNewFrom and oBytes return Object.
When vi
which type is HashTable
aka struct _HashTable *
is used with this Generic at line Object ovi = o(vi);
gcc call char : oBytes( X , 1),
instead HashTable : oNewFrom(HASHTABLE,X),
.
I made any mistake or Generic don't work with structs and typedefs?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…