[pacman-dev] [PATCH 3/3] Align titles automatically in information display

Pierre Neidhardt ambrevar at gmail.com
Sat Oct 17 16:22:36 UTC 2015


On 15-10-17 11:54:40, Dave Reisner wrote:
> > 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.)
> 
> Well, but any clashes are easily resolved. They'd be compile time errors
> as the resulting code would look something like:
> 
>   enum {
>     TITLE_FOO,
>     TITLE_BAR,
>     42,
>     TITLE_BAZ,
>   };
> 
> Since the preprocessed token is no longer an identifier, the compiler
> whines.

Absolutely. But I meant clashes in the nomenclature: If we'd like to add a
'Count' title to pacman -[S|Q]i, we would have to rename '#define TITLE_COUNT'
to something else and adapt the code accordingly. No big deal, but I think it is
good practice to keep separate nomenclatures for the different families of
constants.

Another solution would be to prefix the enum with TITLE_ and the configuration
variables with TITLECFG_ for instance.

-- 
Pierre Neidhardt


More information about the pacman-dev mailing list