Scrubsanity and Crowd Control both want to use bools in C code, but have to use uints because bools need a file included in the header to work in C files.

#include <stdbool.h>

Possibilities at first glance are including it in ultra64.h or global.h.


Looks like this isn't as simple as just adding stdbool.h to a relevant file. Turns out #include "libc/stdbool.h" already is in ultra64.h, but looking into this file now:

#ifndef STDBOOL_H
#define STDBOOL_H

#define __bool_true_false_are_defined 1

#ifndef __cplusplus

#define bool    u32
#define false   0
#define true    1

#endif /* __cplusplus */

#endif /* STDBOOL */

This doesn't actually fix anything if the bool is defined outside of the c file where we want to use the bool. It just has defines that still convert it into a u32.

So it turns out even if the problematic files included ultra64.h (which for example, the scrubsanity one already did) bools still won't work across C++ and C files.


We decided to keep using uints for now. If we want to implement a more proper implementation for bools in C code, we can re-open this.

© 2022 - All rights reserved.