[Nfd-dev] C++11 code style

Junxiao Shi shijunxiao at email.arizona.edu
Sun Nov 2 13:02:37 PST 2014


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.



Yours, Junxiao

On Sun, Nov 2, 2014 at 1:57 PM, Alex Afanasyev <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/ced29cdc/attachment.html>


More information about the Nfd-dev mailing list