lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 19 Mar 2015 16:22:35 -0700
From:	Joe Perches <joe@...ches.com>
To:	Bartosz Golaszewski <bgolaszewski@...libre.com>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Guenter Roeck <linux@...ck-us.net>,
	lm-sensors <lm-sensors@...sensors.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH v4 2/5] documentation: update CodingStyle on local
 variables naming in macros

On Thu, 2015-03-19 at 18:27 +0100, Bartosz Golaszewski wrote:
> Describe proper naming convention for local variables in macros
> resembling functions.
[]
> diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
[]

> +5) namespace collisions when defining local variables in macros resembling
> +functions:
> +
> +#define FOO(x)				\
> +({					\
> +	typeof(x) ret;			\
> +	ret = calc_ret(x);		\
> +	(ret);				\

trivia: ret wouldn't need parentheses here.

> +)}
> +
> +ret is a common name for a local variable - __foo_ret is less likely
> +to collide with an existing variable.

Is shadowing really much of a problem here?

These are statement expression macros and names
have local scope anyway.

It's similar to function arguments using the same
names as parameters.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists