Paul Eggert wrote: > On 07/24/11 10:25, Bruno Haible wrote: >> I thought about this as well, but it has the drawback that "grep '(long)'" >> wouldn't find this occurrence. > > That's a minor disadvantage. Such a grep is doomed to failure, > as gnulib must have hundreds of conversion to 'long' that the 'grep' > will miss. Avoiding the error-proneness of the cast is more important > than using the cast to highlight this particular conversion. > > That being said, it may be that you prefer highlighting this particular > conversion because it may narrow the value. If that's the case, how > about this idea instead? It has a "(long)" that can be grepped for, > and it avoids the cast. > > if (LONG_MIN <= offset && offset <= LONG_MAX) > return /* (long) */ offset; > > Personally I don't like this kind of decoration, as I think it's > unnecessary clutter, but it's better than what we have now because > it avoids the cast.
I'd prefer to avoid catering to a search for '(long)' in part because it will fail whenever someone uses the equivalent '(long int)'. Also, I go to great lengths to avoid casts altogether, just because they are so error- prone in general. That said, if the above helps Bruno, it's fine with me: the commented cast is a nice compromise.