Suggestions

Tony van der Hoff OSLib at mk-net.demon.co.uk
Sat Apr 22 10:37:41 BST 2000


On Fri, 21 Apr 2000, at 19:12:45, Ainsley Pereira
<marble at executor.karoo.co.uk> wrote on the subject "Suggestions":

>Hi,
>
>Might I suggest putting "OSLibInclude:" in all the #includes in oslib to
>prevent them clashing with user supplied headers?
>
Doesn't seem unreasonable to me; can anyone see any drawbacks?

>Also, wrapping the typedef int bool; line in types.h with a
>
>#if !defined(__cplusplus) || defined(__GNUC__)
>typedef int bool;
>#elif defined(__GNUC__)
>#define __swi()
>#endif
>

Firstly, I'm a bit uncomfortable about this use of |bool| in any case.
Wouldn't a better way be to typedef our own boolean operator, e.g.
|typedef int BOOL| and then use that throughout the library code. 

In order to ensure the interface doesn't break, we could then |typedef
bool BOOL|, wrapped up in an ifdef as Ainsley proposes (but with an
extra test || !defined( BOOL_UNDEFINED ) ) and let the user decide
whether or not he wants to define bool himself.

That would make the library's use of BOOL independent of any compiler's
definition (or not) of bool.

Secondly, I'm also a bit uncomfortable about the use of the
(undocumented) macro __swi, which is only applicable to a single
compiler, itself no longer maintained, and probably no longer the
mainstream compiler for the platform. How much real benefit does it
bestow on the library code?

I proposed previously that it should be dropped entirely, but got no
response. Would it be worth considering this?
-- 
Tony van der Hoff         |  Mailto:tony at mk-net.demon.co.uk
                          |  Mailto:avanderhoff at iee.org
Buckinghamshire, England  |  http:www.mk-net.demon.co.uk



More information about the oslib-user mailing list