bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cross-compilation guesses (5)


From: Jim Meyering
Subject: Re: cross-compilation guesses (5)
Date: Thu, 03 May 2012 10:23:42 +0200

Bruno Haible wrote:
> Jim Meyering wrote:
>> However, I would find the above code easier to read if it were
>> written on fewer lines:
>>
>>     case "$host_os" in
>>       *-gnu*) $1 ;; # Guess yes on glibc systems.
>>       *)      $2 ;; # If we don't know, assume the worst.
>>     esac
>
> Will it also work if $1 or $2 contains an m4 comment (dnl something)
> or ends in a shell comment (# something)?

I don't think "dnl" could cause trouble there: either the dnl and
following comment are elided by m4 or they're inserted as literals
to be processed later as shell commands.
But you're right that a shell comment on the last line of the
expansion of $1 or $2 would cause trouble, but only when there
is no trailing newline.

So finally I do prefer yours.

> Also, I like to put comments about statements before the statements,
> not afterwards.

So do I, in general, but I like to keep case-related comments
between the case-introducing "...)" syntax and the ";;" case-terminator.
Otherwise, it seems too easy to miss the comment when re/moving a case
block.

Here, you're welcome to keep your commenting style.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]