Add placeholder for stringifying arrays of unknown type
This commit is contained in:
parent
2c5401aaf7
commit
179648b005
@ -85,6 +85,7 @@ static CORD vas_cord(void *x, const char **fmt, va_list args)
|
||||
void *arg = va_arg(args, void*);
|
||||
return fn(x, arg);
|
||||
}
|
||||
case ' ': return "?";
|
||||
default: errx(1, "Unsupported format specifier: '%c'", c);
|
||||
}
|
||||
errx(1, "Unreachable");
|
||||
|
@ -39,6 +39,7 @@ CORD as_cord(void *x, const char *fmt, ...);
|
||||
double: CORD_asprintf("%g", x), float: CORD_asprintf("%g", x), \
|
||||
CORD: x, \
|
||||
char*: (CORD)({ const char *__str = x; __str && __str[0] ? __str : CORD_EMPTY;}), \
|
||||
array_t: as_cord(&(x), "[ ]"), \
|
||||
default: "???")
|
||||
#define __heap(x) (__typeof(x)*)memcpy(GC_MALLOC(sizeof(x)), (__typeof(x)[1]){x}, sizeof(x))
|
||||
#define __stack(x) &(x)
|
||||
|
Loading…
Reference in New Issue
Block a user