[m-dev.] std.h
Tyson Richard DOWD
trd at students.cs.mu.oz.au
Wed Feb 12 09:28:39 AEDT 1997
> Tyson Richard DOWD, you wrote:
> >
> > In runtime/std.h, we have the following code:
> >
> > #ifndef bool
> > #define bool char
> > #endif
> >
> > Is there any particular reason why this isn't a typedef?
>
> Tom is right about the historical reasons. But one reason that I left
> it unchanged is that `bool' is a rather commonly used name -- for
> example, it defined by <curses.h>. I figured that a conditional
> #define is a little less likely to conflict with other uses of `bool'.
>
> > (I'm asking because it has this horrible tendency to rename
> > 'bool' to 'char' which makes it difficult to initialise the
> > base_type_info for bool without it trying to initialise the
> > base_type_info for char... which of course is just not defined
> > in bool.c).
>
> I don't quite understand here. The automatically-generated
> C code for bool.m should not use any unqualified names such as `bool',
> instead it should use names that include `mercury' somewhere in them.
It doesn't now. It was going to, with changes to initialize
the base_type_infos, but I don't think I'll do it quite that way, since it
causes lots of problems.
(it was going to generate init_base_type_info(bool, bool, 0);
or something... I'll have to generate more verbose code).
--
Tyson Dowd # Another great idea from the
# people who brought you
trd at .cs.mu.oz.au # Beer Milkshakes!
http://www.cs.mu.oz.au/~trd # Confidence --- Red Dwarf
More information about the developers
mailing list