This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCHv3 1/8] Prepare to convert _Complex cosine functions
- From: Joseph Myers <joseph at codesourcery dot com>
- To: "Paul E. Murphy" <murphyp at linux dot vnet dot ibm dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Thu, 18 Aug 2016 16:34:32 +0000
- Subject: Re: [PATCHv3 1/8] Prepare to convert _Complex cosine functions
- Authentication-results: sourceware.org; auth=none
- References: <bf658f0e558ce4524e73d83a361825484c4a3f5b.1471467041.git.murphyp@linux.vnet.ibm.com>
On Wed, 17 Aug 2016, Paul E. Murphy wrote:
> Likewise, in a few files I have removed superfluous
> parenthesis as part of the formatting cleanups.
In at least some cases they aren't superfluous; they are needed for
correct indentation. See where the GNU Coding Standards say:
Insert extra parentheses so that Emacs will indent the code properly.
For example, the following indentation looks nice if you do it by hand,
@example
v = rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000
+ rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000;
@end example
@noindent
but Emacs would alter it. Adding a set of parentheses produces
something that looks equally nice, and which Emacs will preserve:
@example
v = (rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000
+ rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000);
@end example
In patch 2, in cacosh, a similar issue arises; you have:
> + __imag__ res = M_COPYSIGN (signbit (__real__ x) ? M_MLIT (M_PI)
> + : 0,
which is not the indentation you'd get automatically - but there the
parentheses are already present, so you just need to align both the '?'
and the ':' just after the '('. Then in ccosh you have exactly the issue
of removing parentheses that are actually required for indentation:
> - __real__ retval = __copysign (HUGE_VAL, cosix);
> - __imag__ retval = (__copysign (HUGE_VAL, sinix)
> - * __copysign (1.0, __real__ x));
> + __real__ retval = M_COPYSIGN (M_HUGE_VAL, cosix);
> + __imag__ retval = M_COPYSIGN (M_HUGE_VAL, sinix)
> + * M_COPYSIGN (1, __real__ x);
--
Joseph S. Myers
joseph@codesourcery.com