Re: violating function pointer signature
From: Steven Rostedt
Date: Thu Nov 19 2020 - 09:59:57 EST
On Thu, 19 Nov 2020 08:37:35 -0600
Segher Boessenkool <segher@xxxxxxxxxxxxxxxxxxx> wrote:
> > Note that we have a fairly extensive tradition of defining away UB with
> > language extentions, -fno-strict-overflow, -fno-strict-aliasing,
>
> These are options to make a large swath of not correct C programs
> compile (and often work) anyway. This is useful because there are so
> many such programs, because a) people did not lint; and/or b) the
> problem never was obvious with some other (or older) compiler; and/or
> c) people do not care about writing portable C and prefer writing in
> their own non-C dialect.
Note, this is not about your average C program. This is about the Linux
kernel, which already does a lot of tricks in C. There's a lot of code in
assembly that gets called from C (and vise versa). We modify code on the
fly (which tracepoints use two methods of that - with asm-goto/jump-labels
and static functions).
As for your point c), I'm not sure what you mean about portable C (stuck to
a single compiler, or stuck to a single architecture?). Linux obviously
supports multiple architectures (more than any other OS), but it is pretty
stuck to gcc as a compiler (with LLVM just starting to work too).
We are fine with being stuck to a compiler if it gives us what we want.
-- Steve