On Wed, Oct 3, 2018 at 12:05 PM David Sommerseth <
open...@sf.lists.topphemmelig.net> wrote:

> On 03/10/18 17:08, Selva Nair wrote:
> >
> >
> >     To make code more clear, change return type to bool. Also
> >     use stdbool.h header instead of bool definition macros.
> >
> > We do use BOOL all over the service code (unavoidable with
> > Windows API), and bool is used in only one or two places. So would it
> > be better to just change this to BOOL/TRUE/FALSE and not include
> > stdbool.h?
>
> Several years ago, we started towards a path to get rid of the
> BOOL/TRUE/FALSE
> stuff, in favour of stdbool.h.  And when we moved towards -std=c99, this
> made
> this move even more reasonable.
>

Yes, I know that's the path taken in openvpn core sources which is very
sensible in
a cross-platform code.


>
> But ... are you saying Windows C compilers we use/support does not support
> stdbool.h?  Even with -std=c99?
>

It does, but we cannot avoid using the Windows-specific BOOL (which I
believe is a typedef to int pulled in through windows.h)  as Windows API is
replete with it. In fact stdbool's bool may be internally an int and thus
same
as BOOL but we can't assume that.

In case of the service code, which is Windows only, there are about 30 uses
of
BOOL but only a few cases of bool (typdef to int) all of which are in the
deprecated
automatic service code. This patch changes the latter to use stdbool which
is
quite reasonable. But I just wonder whether its just better to use BOOL in
this occasion as the latter is not going to go away in Windows.

That said, I prefer stdbool too, and I'm fine with moving towards replacing
all BOOL
with bool and casting to BOOL if/when required (say, calling Windows API).

Selva
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to