lwpa  0.1.0
LightWeight Platform Abstraction (lwpa)
View other versions:
lwpa_bool

Overview

A C boolean type.

#include "lwpa_bool.h"

In the before-times, C had no boolean type. Then, C99 gave us stdbool.h. But there still exist environments where a C99 compiler is not available or practical, and one allegedly modern toolchain (it rhymes with "Nicrosoft Fishual D++") picks and chooses the modern C features it supports seemingly at random.

This header attempts to detect if it is being compiled with C99 or later (or C++). If it is being compiled with C99 or later it simply includes stdbool.h. If it is being compiled with C++ it does nothing (bool is a native type in C++). If none of the above are true, it creates a boolean type the old-fashioned way: #defines.

Macros

#define bool   char
 Char is used for the fake boolean type as it is guaranteed to be the smallest available type.
 
#define false   0
 False is 0. More...
 
#define true   1
 True is 1. More...
 

Macro Definition Documentation

◆ false

#define false   0

False is 0.

Not much to see here.

◆ true

#define true   1

True is 1.

Not much to see here.