[PATCH 06/10] mtd-utils: add common version printing function

Brian Norris computersforpeace at gmail.com
Mon Jun 27 16:15:23 EDT 2011


On Mon, Jun 27, 2011 at 12:51 PM, Mike Frysinger <vapier.adi at gmail.com> wrote:
> On Mon, Jun 27, 2011 at 14:27, Brian Norris wrote:
>> +/* Simple version-printing for utils */
>> +#define common_print_version() \
>> +do { \
>> +       fprintf(stderr, PROGRAM_NAME " " VERSION "\n"); \
>> +} while (0)
>
> this shouldnt go to stderr

Yeah, I wasn't too sure on that one. There were several utils that
already used stderr, but that doesn't actually make much sense, I
guess.

> if the string is const, then it could just be puts().  but i wonder if
> it shouldnt instead use printf("%s %s\n", PROGRAM_NAME, VERSION) so
> that the string that represents PROGRAM_NAME isn't duplicated in the
> .rodata section.

I'm not sure I know what the exact technical difference would be
between the string concatenation version and the '%s' argument
version...

Brian



More information about the linux-mtd mailing list