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

Re: Having fun with the following C code (UB)



Shachar Shemesh <shachar@debian.org> writes:

> I never did understand what people expect. gcc uses the undefined
> behavior to not emit checks it would otherwise have to, so that your
> code runs faster. This affects not only those corner cases, where you
> are relying on this behaving a certain way, but especially in everyday
> code, where those undefined behavior allows GCC to save you lots of
> cycles.

> Are you really sure you want to have slower code just so that your
> corner cases are easier for you? How is that a reasonable trade-off to
> make?

I don't want, necessarily, to have slower code to make handling corner
cases easier.  However, I am generally happy to have slower code in return
for making the system more secure, as long as the speed hit isn't too
substantial.  Security is a much bigger problem than performance right now
for most people.

The hard part is distinguishing between those two properties.

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>


Reply to: