On Sun, Sep 23, 2012 at 10:14 PM, Nicholas Nethercote
<[email protected]> wrote:
> On Sun, Sep 23, 2012 at 9:48 PM, David Anderson <[email protected]> wrote:
>> I prefer suffixing _. Under ion/* this has been required style for all
>> private member variables. (Anywhere not doing it is probably old code.)
>
> What decoration do you suggest to avoid conflicts for parameters?
Terrence said they've been using |fooArg| for parameters that are
immediately rooted as |foo|. So that's a possibility for avoiding
parameter conflicts.
So, the straw-man minimal changes required to enable -Wshadow are
demonstrated in this example:
class X
{
int x_;
X(int xArg) : x_(xArg) { }
int x() { return x_; }
void setX(int xArg) { x_ = xArg; }
void foo() {
int x0 = x();
// ... use x0 ...
};
};
Rules:
- members are decorated with a '_' suffix if necessary
- parameters are decorated with a 'Arg' suffix if necessary
- local variables are decorated with a '0' suffix if necessary (other
suggestions welcome... AFAIK Gecko doesn't have a standard way of
handling this case, but it does come up occasionally in practice)
BTW, if the above example seems unrealistic, it's not; imagine |X| is
|Vector| and |x| is |length|.
Nick
_______________________________________________
dev-tech-js-engine-internals mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals