Re: Problem of Pass by Reference in C++
From: jeffc (nobody_at_nowhere.com)
Date: 12/15/03
- Next message: jeffc: "Re: Problem of Pass by Reference in C++"
- Previous message: Dave: "Re: The >> token"
- In reply to: Dan Cernat: "Re: Problem of Pass by Reference in C++"
- Next in thread: jeffc: "Re: Problem of Pass by Reference in C++"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 15 Dec 2003 15:12:40 -0500
"Dan Cernat" <dcernat@excite.com> wrote in message
news:aab4eb08.0312150829.2c3fa2f0@posting.google.com...
>
> int &a;
> and
> int& a;
> are exactly the same.
> People prefer the first because is less confusing:
>
> int &a, b; // declares a as reference to an int and b as int
>
> int& a, b; // does the same but someone might think that b is also a
> reference to an int
I prefer the latter because I think it's more clear what the type is. The
type is "int&", not "int" with a variable name of "&a". Furthermore, I
never put built-in types all on one line, because of this problem and
others, e.g.
int i, j = 0;
- Next message: jeffc: "Re: Problem of Pass by Reference in C++"
- Previous message: Dave: "Re: The >> token"
- In reply to: Dan Cernat: "Re: Problem of Pass by Reference in C++"
- Next in thread: jeffc: "Re: Problem of Pass by Reference in C++"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|