On Thursday, 30 October 2014 at 09:39:42 UTC, Ola Fosheim Grøstad
wrote:
On Thursday, 30 October 2014 at 08:02:49 UTC, Paulo Pinto
wrote:
3. No non-const ref parameters to functions, use pointers.
They want a visible "&" at call site for output parameters.
e.g. "read(&var)" so that you don't have to look the function
up in the docs.
Coming from a Quick/Turbo Basic/Turbo Pascal background, I
never understood the C culture about function parameters.
Just another example of C being unsafe.
C is unsafe, but it is desirable to make it visible at the call
site that you are returning a value through a parameter. I
think it is a good idea to create a special "zero-cost" wrapper
type so that you write:
copy_from_to( input, returns(output) )
I noticed that c++11 has a ref() function:
http://en.cppreference.com/w/cpp/utility/functional/ref
In 30 years of coding I never found this to be a problem and it
saved a lot of bad pointers being passed on to functions.
Again, I am spoiled by better languages for systems programming,
even if the market has bet on C and its derivatives.
--
Paulo