The tag has no usage guidance.

learn more… | top users | synonyms

6
votes
4answers
3k views

Function that modifies an argument, should I return the modified object?

We have a function that modifies a JS object, by adding some custom properties to it. The function doesn't return antyhing addTransaction: function (obj) { obj.transactionId = this....
5
votes
4answers
8k views

Is using “out” or “ref” parameters in Java methods to return extra values bad?

I happened to create a mutable class like this: class Mutable<T> { private T value; public Mutable() { this.value = null; } public Mutable(T value) { this.value = value; } T get(...
5
votes
3answers
465 views

non-optional pointers vs. non-const references in C++

In Other C++ Features, Reference Arguments of the Google C++ Style Guide, I read that non-const references must not be used. All parameters passed by reference must be labeled const. It is clear ...
0
votes
5answers
1k views

Named output parameters vs return values

Which code is better: // C++ void handle_message(...some input parameters..., bool& wasHandled) void set_some_value(int newValue, int* oldValue = nullptr) // C# void handle_message(...some ...