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

  • From: gus knight <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 6 Jul 2015 12:45:42 -0400

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

Other related posts: