-
-
Notifications
You must be signed in to change notification settings - Fork 430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Declare public types with tags to allow forward declaration #318
Comments
This is incorrect. You just do this #pragma once
struct Clay_RenderCommandArray;
struct clay_gpu_context;
struct gpu_render_pass;
void clay_gpu_render_commands(
struct clay_gpu_context*, struct gpu_render_pass*, struct Clay_RenderCommandArray* commands,
vec2s frame_size); And it will work fine. |
But aren't |
I had a closer look at this and you are correct that you need do: typedef struct Clay_RenderCommandArray {
// fields...
} Clay_RenderCommandArray; I confused the C rule with the C++ rule which will implicitly name the struct as well as do the typedef. |
Hi @Nelarius, thanks for opening this issue! Looks like an oversight on my part for sure, I'm reasonably certain this wont impact any current usage so very happy for you to PR those changes if you have time! 🙂 |
Problem
In Clay, the public API structs are declared without tags:
This means that, at least to my knowledge, the types can't be forward-declared when defining things in a header for e.g. a render backend:
To be clear, this is a somewhat pedantic request, but it's nice to be able to keep headers as free of includes as possible 🙂
Proposal
Declare public types as
to allow forward-declaring the tag names in our headers.
Would be happy to make a pr if this is something deemed useful.
The text was updated successfully, but these errors were encountered: