[haiku-commits] Re: haiku: hrev49354 - src/servers/app/drawing

  • From: looncraz <looncraz@xxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 06 Jul 2015 14:03:07 -0500

On 7/6/2015 11:45, gus knight wrote:

On Sun, Jul 5, 2015 at 1:32 PM, Paweł Dziepak <pdziepak@xxxxxxxxxxx> wrote:
Neither B_ERROR nor -1 is an invalid semaphore. The former is an error code
the latter is a signed integer.

const sem_id invalid_semaphore = -1;

...and then we can have:

sem_id
BitmapHWInterface::RetraceSemaphore()
{
return invalid_semaphore;
}

and nobody needs to ask what was the original author's intention.
Obviously, it would be even better if implicit casts between sem_id and
integers were disallowed but that would break things like if (sem < B_OK) in
C code.
I'm not sure where that define should go -- and all I was doing here
was making this specific instance of RetraceSemaphore() be exactly the
same as the other 4 instances that all return -1.

-gus



I'd think B_INVALID_SEMAPHORE would make sense in OS.h around line 196
--------------
} sem_info;

const sem_id B_INVALID_SEMAPHORE = -1;

/* semaphore flags */
--------------

-The loon

Other related posts: