cglm
cglm copied to clipboard
"--ansi --pedantic" Compatibility desired
I know it's a pain to implement but could you add support for this particular set of gcc options please?
For variables that are not declared at the top of functions you can use if ( 1 ) { ... } to avoid moving the declarations (I only realised I could use that trick recently), to avoid issues with long long you can swap it out for intmax_t, not like they should be passed to the GPU anyways. In the course of implementing this you'll probably end up noticing the cause of one or two existing issues anyways, plus it's probably easier than those issues anyways.
Just linking a partially related thread:
https://github.com/recp/cglm/issues/149
Hi @awsdert,
I always try to declare variables at top (this may not be true for tests yet), so this may not be ann issue for C89. We can move variables to top if they are not yet...
There is a discussion which may be related: https://github.com/recp/cglm/discussions/222
I'll try to build cglm with --ansi --pedantic later to see what is wrong. You can also share compiler warnings, errors that may help to improve cglm and solve the issue.
Thanks, I'm not in any rush for it so I'll focus on my own project which can still afford to be loose with the standards (though I do use --ansi --pedantic every now and then because I want the final code to fit that standard) while cglm is not yet able to compile under those options, I'm trying to build a graphics engine of my own in pure C89 and I've only recently started learning graphics programming in general, when I get far enough to finish developing a method of ray tracing I have in my head I'll then see what I can do to help with making cglm C89 compatible since I want to leave those options on perminantly.
Just thought of something for the inline thing, should use a macro that you can map between inline and static, something like:
#ifdef __ANSI__
#ifdef CGLM_IMPLEMENT
#define CGLM_INLINE( F, X ) F X
#else
#define CGLM_INLINE( F, X ) F;
#endif
#else
#define CGLM_INLINE( F, X ) inline F X
#endif
CGLM_INLINE( int foo(), {} )