I made (for my branch) a color.c and a color.h, which can be
handy if you're looking at a wall of text and want to spot
something in particular without straining your eyes too much.
It's easy to use:
printf(MAGENTA "foo = %d" RESET, 5);
will give you a nice 'foo = 5' magenta output. There's also
stuff like blue("bar") which can be stuffed into other string
functions.
I wrangled it so that this feature can be turned on with a -D
switch at compile time, ie, in CmakeLists.txt you can do:
set(CMAKE_C_FLAGS "-std=c99 -D_GNU_SOURCE -g -fPIC -DCOLOR_ON=1")
otherwise it's not going to show up.
1) Does anyone else other than me find this kind of thing useful?
2) Is it portable?
3) If 1 & 2, would you enjoy this dev debugging feature being
added?
G
--
Visit my Coding Diary: http://gabriela-gibson.blogspot.com/