When you read the C or pike code
int x = 17; foo(x); printf("%d", x);
you can tell what the third line will do (if ever executed): It will print "17". When reading the same code in a C++ program, you don't know a damn about what happens, until you have looked up the header file declaring the function foo and checked if it contains the &-character or not. This highly nonlocal dependency for a vary basic language features such as argument passing, is very bad for the readability.
For C++, you can argue that references have other nice features (compareed to pointers, which are almost the same thing, just with a more explicit syntax), such as never being NULL, and that those advantages are important enough for sacrificing readability. I'm not convinced, but anyway, in pike you probably wouldn't get those advantages anyway.
/ Niels Möller (med röd bil)
Previous text:
2003-05-13 14:41: Subject: Re: Pointers/lvalues
On Tue, May 13, 2003 at 02:00:02PM +0200, Niels Möller (med röd bil) @ Pike (-) developers forum wrote:
C++. It's ok to have one or two magic functions like sscanf, but if any pike function could do the same, the code gets a lot harder to read.
It depends on the developer, not the language itself. The Roxen code is good example of code which is hard to read, despite the "good" language :)
As of me, "easy to read" means "everybody with _basic_ knowledge of programming [in general] may undestand". So... :)
Regards, /Al
/ Brevbäraren