[haiku-commits] Re: haiku: hrev47853 - src/kits/storage/disk_device headers/private/storage

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 12 Sep 2014 23:08:17 +0200

On 09/12/2014 10:34 PM, Jessica Hamilton wrote:
On 12 September 2014 18:37, Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> wrote:
Why? What was wrong with it before?
Also, we don't use "Pointer" in a name for pointer variables (fortunately,
we don't use Hungarian notation).
Before it was mixing status_t & dev_t in the same return value. Don't
we normally prefer out arguments to a function that returns a
status_t?

You mean like in create_[sem|thread|port|...]()? :-)
We use a reference pointer argument whenever you cannot express an error code else. Ie. for example if a name-getter could fail, a
const char* Name();
could not tell you why it failed besides returning NULL. A
status_t GetName(const char*& name);
can do that. But dev_t/sem_id/... are all positive, and can contain an error code on failure. You don't gain anything by adding that extra argument, you just make the call slightly more complex for no good reason.

Bye,
   Axel.


Other related posts: