> I'm a newbie to C. But I saw that you mentioned undefined behavior.
> Robert C. Seacord's book Effective C warns about undefined behavior in C
> in the topics he discusses. Other books don't even mention it.

Reasoning about what is and what was UB is kind of hard, since C
started out to be a compiler for a certain cpu, then grew into several
somewhat similar types of cpus, then decided it was targeting a
hypothetical abstract cpu and during these changes, certain behaviours
that people were accustomed to suddenly became UB, even if they were
not to begin with.

As the standard has progressed, more and more corner cases of the
language have grown into being UB but it is hard (for me, from the
outside) to know if the actual language changed or if the
implementations of the compilers did and the standards followed.

What we do know now is that tons of old code is now unsafe(r) if
compiled with more recent compilers because the old - and often known
- behaviours are now UB and may at times make code generation "wrong"
when it had a distinct outcome previously. So it is probably neat to
look for UB with as many tools as possible, but to return to your
quote above, perhaps it's not mentioned as prominently as it should
be, because it is almost a transient property of C at some point in
time, using some version of your compiler, so writing it down will age
the book faster than just talking about how the language is meant to
work generally.

-- 
May the most significant bit of your life be positive.

Reply via email to