Usage example:

#include "print.h"

int main() {
print("number:", 25,
"fractional number:", 1.2345,
"expression:", (2.0 + 5) / 3
);
}
number: 25 fractional number: 1.2345 expression: 2.33333 Generic calls are not only easier to type than standard printf (), but there will be no more compiler warnings that the format character after% "is of the wrong type.

Genericprint, can print all major C types, integers, signed and unsigned, floating point and pointers:

char *s = "abc";
void *p = main;
long l = 1234567890123456789;
unsigned char byte = 222;
char ch = 'A';
print("string:", s, "pointer:", p, "long:", l);
print(byte, ch)
string: "abc" pointer: 0x402330 long: 1234567890123456789
222 <0xDE> 'A'65
Different types are displayed in different colors, the palette can be customized, or the color can be turned off altogether.
Tags: printf
Papay 10 march 2021, 16:00