Skip to content

Refactor boolean type definition for C++/-std=gnu23 compatibility#30

Open
Arawn-Davies wants to merge 1 commit intoozkl:masterfrom
Arawn-Davies:patch-1
Open

Refactor boolean type definition for C++/-std=gnu23 compatibility#30
Arawn-Davies wants to merge 1 commit intoozkl:masterfrom
Arawn-Davies:patch-1

Conversation

@Arawn-Davies
Copy link

Changed the definition of 'boolean' type for C++ & -std=gnu23 compatibility, and included base <stdbool.h> header.

This is to help bring it more inline with other source ports (Chocolate Doom mainly) and keep compatibility with new toolchains I think. I didn't come up with this fix (https://blog.svgames.pl/article/the-little-bool-of-doom) but it's helped me work on a port of doomgeneric to PlayStation 2

How easy would it be to get audio working? I think only SDL 1.2 works well on that platform so I'll be using GSKit instead

Changed the definition of 'boolean' type for C++ & -std=gnu23 compatibility, and included base <stdbool.h> header.

This is to help bring it more inline with other source ports (Chocolate Doom mainly) and keep compatibility with new toolchains I think. I didn't come up with this fix (https://blog.svgames.pl/article/the-little-bool-of-doom) but it's helped me work on a port of doomgeneric to PlayStation 2

How easy would it be to get audio working? I think only SDL 1.2 works well on that platform so I'll be using GSKit instead
Copy link

@Slavchu Slavchu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if this repository will update. However, it would be nice if you would resolve comments in case the author wakes up

#else

typedef enum
{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like it is unnecessary to comment, Please, use
#ifndef __bool_true_false_are_defined as it may break compilation on old standards

#include <inttypes.h>

#ifdef __cplusplus
#ifdef __cplusplus || defined(__bool_true_false_are_defined)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#ifdef -> #if defined(__cplusplus) || defined(__bool_true_false_are_defined)

// Use builtin bool type with C++.

typedef bool boolean;
typedef int boolean;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why int? use unsigned char or something like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants