[ovs-dev] [PATCH 1/5] lib/util.c: add ovs_windows_only() cpp macro

Ben Pfaff blp at nicira.com
Wed Oct 22 21:14:42 UTC 2014


On Wed, Oct 22, 2014 at 09:06:01PM +0000, Nithin Raju wrote:
> If we incorporate your comment, the code might look like this:

OK.

> #ifdef _WIN32
> enum {WINDOWS = 1}
> #else
> enum {WINDOWS = 0}
> #endif
> 
> if (WINDOWS) {
>     ovs_assert(n_handlers <= 1);
> }
> 
> Did you mean this?
> 
> There are obviously other clever ways of writing this ASSERT:
>     ovs_assert((WINDOWS && n_handlers <= 1) || !WINDOWS);

I think:
    ovs_assert(!WINDOWS || n_handlers <= 1);
is probably the way that I would write it.  (I guess I was thinking
backward when I mentioned && earlier.



More information about the dev mailing list