tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: NULL pointer arithmetic issues

>> C is not a language.  C is a family of closely related languages.

>> Some of them are suitable for OS implementation.  It appears some of
>> the more recent ones are not, but this does not mean the older ones
>> also aren't.
> From my perception the trend is inversed.  Things that were undefined
> or unspecified in older revisions of C, are more clearly defined now.

You seem to be confusing "clearly defined" with "useful".

Modern members of the C family may indeed be more clearly defined.
That is not the problem.  The problem is...hmm, actually, I misspoke
upthread.  It is not the language that is the problem; it is the
compiler.  Unless - and I find this highly unlikely - there is
something in the latest versions of C _requiring_ the compiler to
perform these unexpected transformations, the language itself is fine;
it is the compiler that is at fault, in that it chooses to take
advantage of the not-forbidden-by-the-spec latitude to "optimize" code
in unexpected ways.

>> [...]; it is not a compiler's place to take the position of "ha ha,
>> the code you wrote is clear but I can find a way to lawyer it into
>> formally undefined behaviour, so I'm going to transform it into
>> something I know damn well you didn't expect".
> Please join the C committee as a voting member or at least submit
> papers with language changes.  Complaining here won't change
> anything.

(1) It might get NetBSD to stop trying to insist on using a compiler
that is not suitable for the purpose.

(2) As I realized above, it's not the language that's the problem.

(3) If you have reason to think the C committee would be interested in
having me as a member, let me know whom to talk to.  I might or might
not actually end up interested in joining, but I'd like more info.

>>> RUST is better defined that C and is indeed used in OS development
>>> these days
>>  I don't see how this is related to the rest of the
>> discussion.
> As C is considered as not suitable for OS development,

Once again, there is no such language as C.  There is a family of
closely related languages collectively called C.

But it's actually the compiler, not the language.

> there is an escape plan, already with a successful story in this
> domain.

There's another one, and one that doesn't require the complete rewrite
a switch as drastic as C->rust would: various compilers (including
older versions of the gcc family) that don't think it reasonable to
take clear code and language-lawyer it into broken executables.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

Home | Main Index | Thread Index | Old Index