Commit 931ce55f authored by Martin Dørum's avatar Martin Dørum

betterified

parent 4e2d653f
......@@ -5,7 +5,7 @@ Git: <https://gitlab.com/mort96/blog/blob/published/content/00000-home/draft-c-c
I [wrote a blog post](https://mort.coffee/home/obscure-c-features) about some
weird features of C, the C preprocessor, and GNU extensions to C that I used in
my testing library.
my testing library, Snow.
This post will be about some of the weird compiler and language
quirks, limitations, and annoyances I've come across.
This post is not meant to bash compilers or the specification;
......@@ -101,19 +101,37 @@ Now our code works with both Clang and with GCC, and should work with all other
compilers which don't try to immitate GCC - but for every compiler which does
immitate GCC, we would have to add a new special case.
This is starting to smell a lot like user agent strings.
The Intel compiler is at least nice enough to define `__GNUC__`
to be the version of GCC installed on the system;
so even though our version check is completely irrelevant in the Intel compiler
The Intel compiler is at least nice enough to define `__GNUC__` and
`__GNUC_MINOR__` according to be the version of GCC installed on the system;
so even though our version check is completely irrelevant in the Intel
compiler,
at least it will only prevent an otherwise C11-compliant Intel compiler
from using `_Generic` if the user has an older version of GCC installed.
> **User**: Hi, I'm using the Intel compiler, and your library claims
> my compiler doesn't support C11, even though it does.
> **You**: Upgrading GCC should solve the issue. What version of GCC do you
> have installed?
> **User**: ...but I'm using the Intel compiler, not GCC.
> **You**: Still, what version of GCC do you have?
> **User**: 4.8, but I really don't see how that's relevant...
> **You**: Try upgrading GCC to at least version 4.9.
(Relevant: [Intel's Additional Predefined Macros page](https://software.intel.com/en-us/node/524490))
## \_Pragma in macro arguments
C has had pragma directives for a long time;
it's a useful way to tell our compiler something implementation-specific;
C has had pragma directives for a long time.
It's a useful way to tell our compiler something implementation-specific;
something which there's no way to say using only standard C.
For example, using GCC, we could use a pragma directive to tell our compiler
to ignore a warning for a specific line,
to ignore a warning for a couple of lines,
without changing warning settings globally:
``` C
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment