This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Compare addresses in operand_equal_p correctly


Andrew Haley <aph@redhat.com> writes:
> Roger Sayle writes:
>  > 
>  > On Tue, 14 Nov 2006, Andrew Haley wrote:
>  > > Insert extra parentheses so that Emacs will indent the code
>  > > properly. For example, the following indentation looks nice if you do
>  > > it by hand,
>  > >
>  > >      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;
>  > >
>  > > but Emacs would alter it. Adding a set of parentheses produces
>  > > something that looks equally nice, and which Emacs will preserve:
>  > >
>  > >      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);
>  > 
>  > I believe that this is to prevent *always* aligning equal operators
>  > under one another, when there's a good aesthetic reason, otherwise
>  > this ends up as:
>  > 
>  >       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;
>  > 
>  > which is OK, but hides the utime/tv_sec/tv_usec symmetry.
>
> The original example was
>
> 	  return (OP_SAME (0)
> 		  && OP_SAME (1)
>  		  && OP_SAME_WITH_NULL (2)
>  		  && OP_SAME_WITH_NULL (3));
>
> which needs the parens lest it be turned into
>
> 	  return OP_SAME (0)
> 	    && OP_SAME (1)
> 	    && OP_SAME_WITH_NULL (2)
> 	    && OP_SAME_WITH_NULL (3);

Right.  To be clear, this was indeed what I meant in my original reply.
Sorry for being so terse.

Richard


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]