Thanks for all the good tips! On 15-10-17 09:11:02, Dave Reisner wrote:
Nit: it'd be more clear to use TITLE_ as a prefix instead of T_.
These constants are used to index the 'titles' variable. Having a TITLE prefix would make it look like titles[TITLE_DESCRIPTION] which I find a bit redundant. It also avoids potential future clashes with TITLE_MAXLEN and TITLE_COUNT. (I removed the other TITLE_* variables as you suggested.)
+ /* make aligned titles once only */ + static int need_alignment = 1; + if(need_alignment) { + need_alignment = 0; + make_aligned_titles(); + }
Why not just have make_aligned_titles() return a dummy int value? Then, you can:
static const int make_aligned_once = make_aligned_titles();
I don't think this would work: static variables are initialized at compile time if I'm not mistaken. -- Pierre Neidhardt