This is the mail archive of the ecos-patches@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix configuration in assert.h.


Jonathan Larmour <jifl@jifvik.org> writes:

> Sergei Organov wrote:
>> Well, CYGINT_ISO_EXIT has the default ("data"?) flavor but so are a
>> lot
>> of other CYGINT_xxx even in the same isoinfra.cdl, but
>> CYGINT_ISO_STDIO_FORMATTED_IO as well as many other has "booldata"
>> flavor.
>> Why the difference? Could somebody please explain, why, for example,
>
> This is one of the (many!) things that I did a long time ago that was
> meant to have been cleaned up but wasn't. I knew about it, but there
> was a project deadline, and then I had to move onto other things. You
> know how it goes.

Yeah, sure I do ;)

> I had got part way through converting them to booldata (initially they
> were all the default flavor) but timed out. In case you are wondering,
> this is because Bart implemented "flavor booldata" for interfaces near
> the end of the project in question.
>
> 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

Well, here I strongly disagree. My own experience tells me it's more
easy and less error-prone when a boolean/numeric option is always
defined to something, resulting in

#if SOMETHING

or

#if SOMETHING > 0

checks instead of

#ifdef SOMETHING

One of the primary advantages is that in the former case one can turn on
-Wundef option of the compiler and get a warning should the variable be
mistyped, or corresponding header with the definition is missed, or the
configuration option is gone. For me it's a huge helper of the same
power as necessity do declare variables/functions in C/C++.

[...]

> I would be very grateful if you did clean up all the isoinfra options
> to be booldata.

But I'd prefer they were just data (or whatever it is called) instead,
so that they are always defined.

-- Sergei.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]