This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Major misuse of cyg_bool ?
- From: Eric Doenges <Eric dot Doenges at DynaPel dot com>
- To: ecos-discuss at sources dot redhat dot com
- Date: Wed, 27 Aug 2003 10:08:36 +0200
- Subject: [ECOS] Major misuse of cyg_bool ?
While trying to compile the latest CVS sources of eCos, I ran into
what I think is a major misunderstanding of the C/C++ type system:
cyg_bool is defined as 'typedef int cyg_bool_t;' in kapi.h. As far
as I understand C/C++ type rules, this does not make cyg_bool_t a valid
synonym for int, yet eCos source code uses it that way, for instance in
/data/erdo/ecos-release/ecos-2.0/packages/io/serial/v2_0/src/common/serial.c:68:
warning: a value of type "Cyg_ErrNo (*)(cyg_io_handle_t, cyg_uint32,
CYG_ADDRWORD)" cannot be used to initialize an entity of type "cyg_bool
(*)(cyg_io_handle_t, cyg_uint32, CYG_ADDRWORD)"
/data/erdo/ecos-release/ecos-2.0/packages/io/serial/v2_0/src/common/serial.c:493:
error: declaration is incompatible with "Cyg_ErrNo
serial_select(cyg_io_handle_t, cyg_uint32, CYG_ADDRWORD)" (declared at
line 64)
Note that the compiler I use for my hardware platform is a
vendor-specific compiler that is mostly compatible to gcc (compatible
enough to compile a pre-release version of 2.0 eCos and 2.2 Linux), so
this may just be a warning when compiled with gcc. However, I still
think this is a bug, since any compiler warning is indication of sloppy
programming and should be fixed.
Since the same error occurs with the 2.0 release version of eCos,
I'm wondering if I'm missing something obvious to everyone else or
if this is something that should be fixed ?
--
--------------------------------------------------------------------
| Eric Doenges | DynaPel Laboratories GmbH |
| Tel: +49 89 962428 23 | Fraunhoferstrasse 9/2 |
| Fax: +49 89 962428 90 | D - 85737 Ismaning, Germany |
--------------------------------------------------------------------
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss