[Nfd-dev] C++11 code style

Alex Afanasyev alexander.afanasyev at ucla.edu
Sun Nov 2 13:16:17 PST 2014


> On Nov 2, 2014, at 1:02 PM, Junxiao Shi <shijunxiao at email.arizona.edu> wrote:
> 
> Hi Alex
> 
> This rule (and many other rules) uses the keyword "should".
> "should" is to be interpreted according to RFC2119, which means an exception can be granted when properly justified.
> 
> What about:
> rule x. `auto` type specifier SHOULD only be used for local variables.

That’s ok.

> 
> Yours, Junxiao
> 
> On Sun, Nov 2, 2014 at 1:57 PM, Alex Afanasyev <alexander.afanasyev at ucla.edu <mailto:alexander.afanasyev at ucla.edu>> wrote:
>> rule x. `auto` type should only be used for local variables.
>> 
>> Where else, potentially, it can be used?
>> 
>> `auto` specifier can be used to declare variables at any scope: block scope, namespace scope, init statement of for loop.
>> The proposed rule is to forbid using `auto` specifier at namespace scope, because such usage makes the code less readable.
> 
> I would avoid making such an explicit rule.  I would rather take case by case approach, where namespace-scope auto should be  generally avoided, but if it makes sense to use it, it can be used.
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/nfd-dev/attachments/20141102/5e2e1e64/attachment.html>


More information about the Nfd-dev mailing list