Re: what am I missing?
- Posted by jimcbrown (admin) Jun 20, 2009
- 1085 views
You guys shouldn't be counting bytes. Use the sizeof() operator the C compiler will tell you how big the structure is.
I'm not writing C code but euphoria binding to termios, so sizeof() is of no use to me.
jacques
The catch here is that c_ispeed doesn't follow immedialely the c_cc[NCCS] array. There is 3 bytes of padding. It is why sizeof(struct termios) report 60 bytes. Not nice for those who try to bind C code to hide such information. Jacques
Agreed. In general, I'd recommend writing a partical C wrapper in between the library and the part of the wrapper written in Euphoria, in the way Matt has a custom C library that wraps wxWidgets in C first before being wrapped in Eu, and the way Irv used to have a C library that wrapped parts of GTK (like the C macros which otherwise had to be ported by hand and then hardcoded in Eu) for euGTK.
In fact, I seem to recall that the C library wrapper for EuGTK specifically had functions that merely returned the value of a sizeof().