codeblog code is freedom — patching my itch

October 28, 2005

gcc extensions

Filed under: General — kees @ 7:30 am

Robert Love wrote up a great summary of GCC extensions. Recommended reading! This is exactly the kind of summary I’ve been hoping to run into. Maybe I can go through Inkscape adding all sorts of fun tags to functions and variables now. :)

© 2005, Kees Cook. This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 License.
CC BY-SA 4.0

2 Comments

  1. It’s probably worth noting he is writing specifically about C.

    ‘inline’ is a standard language feature in C++ (not so in C…), so if you bring this header into Inkscape you’d better remove the #defines of ‘inline’ to avoid messing up the normal C++ semantics.

    Comment by MenTaLguY — October 28, 2005 @ 9:03 am

  2. The keyword inline is part ISO C99. It’s just not a C89 feature. It is also a GCC extension and for extern functions the semantics are not 100% identical but it can be safely used for static functions albeit small functions will be inlined anyway when optimizing so it’s not so horribly important. C code is by definition no C++ code. If you write your C code so that a C++ likes it too, you’ll have to write ancient style C and all those pointless cast make your code ugly and less safe. There’s no point in compiling C code with a C++ compiler and C++ is just the worst C derivative of all.

    Comment by Chris — August 31, 2006 @ 2:39 am

Powered by WordPress