I'll preface this by saying that I may be missing something completely so please correct me if I'm missing something.
Basically by using a mix of C/C++ we're creating a monster of a codebase that'll be tough to port later (or now in my case).
Is there a reason why we're using C++ struct definitions in the handmade source instead of just straight up C structs?
In particular I'm looking at the struct definitions in handmade.h
(example)
| struct game_offscreen_buffer
{
void *Memory;
int Width;
int Height;
int Pitch;
int BytesPerPixel;
};
|
For a C compiler, that struct has to be referenced as `struct game_offscreen_buffer` but the handmade source just uses it like `game_offscreen_buffer` as one would in C++.
Sure one can get around this by compiling with a C++ compiler but not every platform has (good) C++ compatibility (ie Swift).
Could make this immensely less painful just by typedef'ing the thing:
| typdef struct game_offscreen_buffer
{
void *Memory;
int Width;
int Height;
int Pitch;
int BytesPerPixel;
} game_offscreen_buffer;
|
Also using booleans directly which is cool in C++ but takes importing stdbool.h in C.
With those changes the entire handmade codebase becomes straight C (rather than this weird mashup of C/C++). It's not like we're using any actual C++ features anyways (ie classes, etc).
I know these are nitpicks but a few changes here and there and it will make the code much more portable and makes putting together a platform layer easier...