public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] improving type safety in kapi c-language interfaces?
@ 2000-06-06  1:22 Dale Hagglund
  0 siblings, 0 replies; only message in thread
From: Dale Hagglund @ 2000-06-06  1:22 UTC (permalink / raw)
  To: ecos-discuss

The company I work for has pretty much decided to go with ecos for our
embedded o/s, using the c-language interfaces provided by kapi.cxx and
kapi.h.  On the whole, ecos appears to provide the features we want in
a relatively simple and compact package.

However, one thing we've noticed about these function that we don't
particularly care for is their use of cyg_handle_t as a generic type
for all sorts of objects.  It seems unfortunate to have weakened the
type safety of the underlying c++ interfaces.

Having looked at kapi.[ch], it seems to me it would be relatively easy
to replace the common cyg_handle_t with separate cyg_thread_handle_t,
cyg_counter_handle_t, and cyg_clock_t and so on.  Declaring these as
pointer types to incomplete structs, ie,

        typedef struct cyg_thread_handle *cyg_thread_handle_t;
        ...

would preserve their opaque nature, yet buy back some compile-time
type checking in the c-language interface.  Is my assumption that this
change would be straightforward correct, or is there something I'm
missing?

Would a patch on the lines suggested above being accepted into ecos?
I suspect the answer would be no, simply because it represents an
incompatible change in the interface.  Since we'd prefer not to
maintain separate patches to ecos, our alternative is to provide
wrappers for the parts of the ecos interface we intend to use, which
can provide a better level of type checking.

Dale.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-06-06  1:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-06  1:22 [ECOS] improving type safety in kapi c-language interfaces? Dale Hagglund

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).