I think i is completely inconsequential where the * is placed. I don't think it would affect, in whatever fashion, my ability to read and understand a piece of code.

--
Nilay


On Wed, 11 Jan 2012, Steve Reinhardt wrote:

Yes, thanks William for the pointers, that was informative.

Andreas may be following Mr. C++, but some of us learned to code on K&R, so
we have history on our side!  Plus as one of the stackoverflow commenters
said, "Note: Bjarne is not the authority on style he is just a person".
That might also be true for K&R, though the matter is more debatable ;-).

Basically this is not an argument about which is better though.  I think
there are good arguments on both sides, and if we were starting from
scratch I might be convinced to use "Port* p".  But given the amount of
code we already have, and that "Port* p" isn't enough better to justify
rewriting everything, I think there are just two choices:

A.  Agree that consistency isn't critical here, and let people do whichever
one they want.
B. Agree that consistency is important and force people like Andreas to
deal with "Port *p".

To me, the choice is really about the importance of consistency vs.
minimizing the onerousness (onerosity?) of the style rules.  Sounds like
Gabe and I are on the fence, while Korey is for B.  Nate?  Ali?  Anyone
else?

Steve

On Wed, Jan 11, 2012 at 7:48 AM, Korey Sewell <[email protected]> wrote:

Thanks William, that was thorough!

I prefer the Port *p personally and maybe that's just old habit.

And since most of the old code is that way, we should replace-in-file any
differences to the "old way" and then update the style guide.

And I nominate Nate to add in a gem5 style hook to enforce this (haha,
j/k)!

On Wed, Jan 11, 2012 at 5:17 AM, William Wang <[email protected]>
wrote:

int* p;  // OO Style, Type emphasis
int *p;  // Procedural style, Expression emphasis
int * p; // Unconventional Style, No emphasis

A public coding style from Google:


http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Pointer_and_Reference_Expressions
// These are fine, space preceding.
char *c;
const string &str;

// These are fine, space following.
char* c;    // but remember to do "char* c, *d, *e, ...;"!
const string& str;

char * c;  // Bad - spaces on both sides of *
const string & str;  // Bad - spaces on both sides of &

A discussion on stackoverflow:
What's your preferred pointer declaration style, and why?


http://stackoverflow.com/questions/377164/whats-your-preferred-pointer-declaration-style-and-why




-- IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy
the
information in any medium.  Thank you.

_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev




--
- Korey
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to