Walter Bright:
> > Out parameters are initialized at function entry, so in theory all is good
> > and there are no bugs, but this is a *workaround*, a language kludge, a 
> > hack,
> > something dirty that is done because of language limitation, or to keep the
> > language compatible with an ancient C design, or because the design is old.
> 
> I don't agree. For one thing, C and C++ do not even have out parameters.

In C and C++ you use pointers and & arguments to perform the same thing, in an 
even less safe way (they don't get initialized).
But if you think that "out arguments" aren't something logically backwards, 
something that looks like a hack that is present just to work around some kind 
of language/compiler/design/brain limit, then there is something profoundly 
different in how our brains are designed :-) For me function arguments are 
something that goes in a function, and the results are something that comes 
out. In a real language there can be exceptions to this (like ref return values 
of D2), but I have always assumed out arguments are just a kind of hack done 
because of some compiler limit, I have never thought of them as something 
"nice" or safe, or logically good.

Bye,
bearophile

Reply via email to