This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
Re: [PATCH] Fix configuration in assert.h.
Bart Veer <bartv@ecoscentric.com> writes:
>>>>>> "Sergei" == Sergei Organov <osv@javad.com> writes:
>
> <snip>
>
> >> The answer is that I intended that they should _all_ be
> >> booldata, since I want it to behave pretty much like a boolean
> >> - the interface can only be on or off, and it's easier and more
> >> conventional to use ifdefs rather than ifs for boolean macros
>
> Sergei> Well, here I strongly disagree. My own experience tells me
> Sergei> it's more easy and less error-prone when a boolean/numeric
> Sergei> option is always defined to something, resulting in
>
> Sergei> #if SOMETHING
>
> Sergei> or
>
> Sergei> #if SOMETHING > 0
>
> Sergei> checks instead of
>
> Sergei> #ifdef SOMETHING
>
> Sergei> One of the primary advantages is that in the former case
> Sergei> one can turn on -Wundef option of the compiler and get a
> Sergei> warning should the variable be mistyped, or corresponding
> Sergei> header with the definition is missed, or the configuration
> Sergei> option is gone. For me it's a huge helper of the same
> Sergei> power as necessity do declare variables/functions in
> Sergei> C/C++.
>
> Sergei> [...]
>
> >> I would be very grateful if you did clean up all the isoinfra options
> >> to be booldata.
>
> Sergei> But I'd prefer they were just data (or whatever it is
> Sergei> called) instead, so that they are always defined.
>
> In the initial implementation CDL interfaces always had the "data"
> flavor. That was found to be too limiting, so support for different
> flavor interfaces was added. The default is still "data", and
> individual developers can choose to stick with that based on personal
> preferences.
What's the advantages of "booldata" for interfaces that as far as I
understand always have numeric value with the meaning "the number of
implementors"? It seems that defining it to 0 when there are no
implementors is not a limitation?
So could we agree that "booldata" should be avoided for CDL interfaces
in the long run?
In the short run, I think I should change my patch the way you've
suggested:
#if defined(CYGINT_ISO_STDIO_FORMATTED_IO) && CYGINT_ISO_EXIT
With the current situation when half of them are "data" and another half
is "booldata", I'd check for them using:
#if defined(XXX) && XX
so maybe
#if defined(CYGINT_ISO_STDIO_FORMATTED_IO) && CYGINT_ISO_STDIO_FORMATTED_IO &&\
defined(CYGINT_ISO_EXIT) && CYGINT_ISO_EXIT
is better?
-- Sergei.