Boost logo

Boost :

Subject: Re: [boost] Warning policy? local variable hides (i.e. shadows) global variable
From: Robert Ramey (ramey_at_[hidden])
Date: 2015-01-15 11:47:20


If you want to make it a "guideline" I would be OK with that. If you want to
make something stronger - I think that this would be a bad idea. The basic
problem is that this couples a derived class to it's parent(s) and a library
author doesn't always control it's parents: example:

template<typename T>
struct opaque_type : public T {
    ...
    const char *name = "...";
};

struct user_class : public opaque_type<T> {
   ... // user might really want to shadow
   const char *name = "asdfasdf";
};

This is a contrived example, so don't call me on this one. My real point is
that it's hard to predict the cases where a "hard rule" would be problem.

Robert Ramey

--
View this message in context: http://boost.2283326.n4.nabble.com/Warning-policy-local-variable-hides-i-e-shadows-global-variable-tp4671123p4671162.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk