Should Prism use -std=gnu99 instead of -std=c99?
I noticed https://github.com/ruby/rbs/commit/67a6acaa0f62a5f984cbf4a54a35600da0d1467f
I wonder if it might be a bit faster with -std=gnu99.
Not sure if -std=gnu99 is accepted on Windows, but probably yes if gcc is used on Windows (MSYS2).
Interesting. Can we detect if it's gcc and use it conditionally?
I'm not sure, maybe @nurse would know since he authored that change? I think we should first check if it changes anything performance-wise, maybe those builtins are not used or are not performance-critical for YARP.
As I wrote the commit comment, -std=c99 disable some optimizations. Unless you have a specific reason to disable such optimizations, you should use -std=gnu99. Note that as far as I understand -std=c99 doesn't provide you more portability. Don't use -std=c99 unless you have a specific reason.
Note that as far as I understand
-std=c99doesn't provide you more portability.
Do you mean better to not specify any -std=, do you mean -std=gnu99 is as portable as -std=c99?
I guess both gcc and clang support -std=gnu99, but MSVC probably not. But MSVC does not even support -std= probably, it uses a slightly different syntax IIRC.
Sorry I'm not entirely clear. Is it safe to replace c99 with gnu99? I'm happy to do that, I just don't want to break anything...
It appears from some cursory research that gnu99 is c99 + specific GNU extensions. The whole reason we went with c99 in the first place was to ensure we didn't accidentally try to use GNU extensions because we were failing to compile on some machines.
We probably should have an optimized versus debug build anyway, maybe for local development we use c99 without optimizations and for the gem we use gnu99 with optimizations. Would that make sense?
Going to close this for now until we have more information