This is the mail archive of the 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] Trivial cleanup

On 09/25/2013 11:33 AM, Jeff Law wrote:

I was looking at the vec class to figure out the best way to do some things and realized we have a "last" member function. Using foo.last() is clearer than foo[foo.length() - 1]

On a related note, our current standards require a space between a function name and the open paren for its argument list. However, it leads to fugly code in some cases. Assume foo is an vec instance and we want to look at something in the last vector element. Our current standards would imply something like this:

foo.last ()->bar

Which is how the current patch formats that code. However, I typically see this more often in C++ codebases as


But then, what if we just want the last element without peeking deeper inside it?

foo.last ()?



Do we want to make any changes in our style guidelines to handle this better?

I noticed that with the wrapper conversion, often you will get a sequence of 3 or more method calls, and its quite unbearable to have the spaces.
simple things like
  int unsignedsrcp = ptrvar.type().type().type_unsigned();
  int unsignedsrcp = ptrvar.type ().type ().type_unsigned ();

I was going to bring it up at some point too. My preference is strongly to simply eliminate the space on methods...


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