--- Comment #19 from Chad Joan <>  2009-07-30 14:00:29 PDT ---
(In reply to comment #17)
> You assume that the above is a bug and what I really wanted was to return a
> reference. Take another look while assuming that I actual do want return by
> value and the return by reference would be a bug.

I suppose what caught me is that it's easily possibly to write
GetProcessOutput() such that a ref return isn't a bug.  Just make sure the
reference doesn't point to an OutputHandle that's already in use.  I feel like
having a value return there is unnecessary.  

What I will give here though is that forbidding such function calls would
prevent the use of the caller's stack frame as a source of memory storage, but
only while using 1 liners to make the call.  It's complicated by the fact that
the function writer has to make the verbosity/efficiency tradeoff for the

Then again...

ref OutputHandle GetProcessOutput( OutputHandle* buffer = null ) {...}

So it's possible to allow the caller to optionally provide stack space if they
want to, and still return ref.  If efficiency isn't an issue, it's still a
one-liner on the call side.

I'll admit that in the given circumstances this is not as clean.  Being able to
call off of rvalues allows both efficiency and brevity in this case.

I'd still rather have something that is a bit more verbose in some cases but
nearly impossible to unintentionally create bugs with.  It's not like actual
functionality is being removed.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to