Thanks Steve, it sounds good to me. Coincidentally, the use of default arguments in C++ is probably worth actively discouraging (but not prohibit).
Andreas From: Steve Reinhardt <ste...@gmail.com<mailto:ste...@gmail.com>> Date: Wednesday, 26 November 2014 18:11 To: gem5 Developer List <gem5-dev@gem5.org<mailto:gem5-dev@gem5.org>> Cc: Andreas Hansson <andreas.hans...@arm.com<mailto:andreas.hans...@arm.com>>, Gabe Black <gbl...@eecs.umich.edu<mailto:gbl...@eecs.umich.edu>> Subject: Re: [gem5-dev] Review Request 2523: config: Get rid of some extra spaces around default arguments. On Wed, Nov 26, 2014 at 4:30 AM, Gabe Black via gem5-dev <gem5-dev@gem5.org<mailto:gem5-dev@gem5.org>> wrote: Just to make sure we're all on the same page, I removed the spaces here because these are default values for arguments. My brain might have just pattern matched and applied a rule for named function arguments in python we use at work, but, unless there's a policy against it, I still like the way it looks in this case. For other uses of "=" and other operators I think there should definitely be spaces. I'm a little surprised to see that there's no mention of spacing around operators on the wiki page. Of course, we've been enforcing spacing around operators (including assignment operators) anyway, and we should update the style guide to reflect that. I, at least, have also been treating '=' differently when used to bind default parameter values, and consider spaces there to be at best optional if not discouraged, though we don't have a hard rule against them. I see that the Google Python style does though: http://google-styleguide.googlecode.com/svn/trunk/pyguide.html#Whitespace I'd be happy to follow the Google style guide on this and get rid of spaces around '=' for default parameters. They also ban spaces for calls using keyword arguments, which I think we also generally follow, but probably not consistently either. I'd say if we're going to follow Google here we should go all the way and do it for both cases. I would also say that, if we're going to ban spaces for default parameters, we should make this apply to C++ as well as Python for consistency. Interestingly, Google doesn't have this policy, because their C++ style guide generally disallows default parameters in C++ to begin with: http://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Default_Arguments Just to put a stake in the ground, I added the following two bullets under http://gem5.org/Coding_Style#Spacing: * one space around binary operators (+, -, <, >, etc.) including assignment operators (=, +=, etc.) * no space around '=' when used in parameter/argument lists, either to bind default parameter values (in Python or C++) or to bind keyword arguments (in Python) I'm happy to edit/remove them if there's disagreement, but I figured this would give something concrete and concise to discuss. Steve -- 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. ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2557590 ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2548782 _______________________________________________ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev