On Sep 15, 2005, at 5:28 PM, Eric Seidel wrote:
It makes more sense in C++ to think of reference-ness as part of the type. In fact, many C++ programmers will also write the * next to the type name, but we decided not to do this to avoid diverging from the typical ObjC and C practice. Another way to think of it is that a Foo * is accessed through different syntax than a Foo (you use * to get the value, -> to dereference a field or method, etc), but a Foo& behaves syntactically just like a Foo. If you declare "Foo *bar" then indeed "*bar" has type Foo, but if you declare "Foo &bar" it is not the case that "&bar" has type Foo, in fact it will have type "Foo *". It only makes sense to say bar has type "Foo&".
We don't like multiple declarations on one line either, proper style for this would be: Foo& bar; Foo& baz; But even that is not right, because you can't declare a reference without initializing it (unseated references are forbidden in C++), and you also rarely want a reference as a local variable.
|
_______________________________________________ webkit-dev mailing list [email protected] http://www.opendarwin.org/mailman/listinfo/webkit-dev
