groff
[Top][All Lists]
Advanced

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

Re: [Groff] Strange error messages from Groff 1.22.3


From: Keith Marshall
Subject: Re: [Groff] Strange error messages from Groff 1.22.3
Date: Sat, 22 Nov 2014 15:20:27 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 22/11/14 10:47, Werner LEMBERG wrote:
> 
>> Out of curiosity, why did you prefer this:
>>
>>   +#if defined(__MSDOS__) || (defined(_WIN32) && !defined(__CYGWIN__))
>>   +void normalize_for_lf (string &fn)
>>   +{
>>   +  int fnlen = fn.length();
>>   +  for (int i = 0; i < fnlen; i++) {
>>   +    if (fn[i] == '\\')
>>   +      fn[i] = '/';
>>   +  }
>>   +}
>>   +#else
>>   +void normalize_for_lf (string &)
>>   +{
>>   +}
>>   +#endif
>>
>> to my original change:
>>
>>   +void normalize_for_lf (string &fn)
>>   +{
>>   +#if defined(__MSDOS__) || (defined(_WIN32) && !defined(__CYGWIN__))
>>   +  int fnlen = fn.length();
>>   +  for (int i = 0; i < fnlen; i++)
>>   +    {
>>   +      if (fn[i] == '\\')
>>   +       fn[i] = '/';
>>   +    }
>>   +#endif
>>   +}
> 
> With your version, I get a warning about an unused variable `fn' if
> not compiling for MS.  The standard C++ solution to suppress this
> warning is to simply omit the parameter's name in the function's
> signature, and exactly this I've done in my version.

I might have been inclined to replace the prototype declaration, for the
non-MS case, with a null macro:

    :
  #else
  # define normalize_for_lf(S)
  #endif

so that you also avoid the call overhead, at point of use.

-- 
Regards,
Keith.



reply via email to

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