vitlabuda / tundra-nat64

A minimal, user-space, stateless NAT64, CLAT and SIIT implementation for Linux
BSD 3-Clause "New" or "Revised" License
38 stars 4 forks source link

Excessive use of #define for neverchanging strings #3

Closed DanielG closed 4 months ago

DanielG commented 1 year ago

Hi Vít,

tundra uses a particularly irritating #define pattern all over the codebase. You seem add a define for every config file or commandline option. This seems an entirely redundant practice to me as these user-facing strings should not change as compatibility with existing configs will be broken that way. Therefore there is no upside to having the strings defined centrally, from where I sit this just seems to have downsides.

Here's one example: I'm making tundra's --help output compatible with help2man so we can have a manpage without writing roff and keeping that up-to-date by hand. This requires aligning list items with an indented column of text for the description, like so:

*MODES OF OPERATION*\n\
  translate  The program will act as a stateless NAT64/CLAT translator.\n\
             This is the default mode of operation.\n\
\n\

The alignment is obvious when translate is a plain string but when expanding "T64C_CONF_CMDLINE__OPMODE_TRANSLATE" this is a tiring game of trial and error. Further if the OPMODE_TRANSLATE define were ever to change, the alignment, together with the manpage will be broken without it being obvious.

Thanks, --Daniel

vitlabuda commented 4 months ago

Hi, this has been fixed in 03172e70832a36e975958b11fc817722cfe088ba. -- Vít