[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Specially crafted binary chunks can cause Lua to crash
- From: David Given <dg@...>
- Date: Fri, 28 Mar 2008 00:17:51 +0000
Ralph Hempel wrote:
[...]
> Hopefully your compiler won't optimize that out, and it's not
> actually atomic in the sense that it's thread safe :-)
The compiler *must not* optimize it out --- that's incorrect code! And I
mean 'atomic' in the this-is-a-fundamental-concept sense, rather than in
the synchronisation sense.
> Does the more verbose but clear (i ? true : false) generate better
> or worse code in terms of speed or size?
Personally, I find that rather less clear --- too wordy and doesn't
adequately encapsulate what it is I'm trying to do. I'd expect any
modern compiler to generate the same code for both. However, optimising
!! is a rather easier job that ?:; the latter is a conditional, and
would require the compiler to recognise the intent of the entire
operation and replace it with equivalent code, whereas optimising !!
merely requires it to know what happens when you perform ! twice.
--
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│ "I have always wished for my computer to be as easy to use as my
│ telephone; my wish has come true because I can no longer figure out
│ how to use my telephone." --- Bjarne Stroustrup
Attachment:
signature.asc
Description: OpenPGP digital signature
- References:
- Re: Specially crafted binary chunks can cause Lua to crash, Luiz Henrique de Figueiredo
- Re: Specially crafted binary chunks can cause Lua to crash, Peter Cawley
- Re: Specially crafted binary chunks can cause Lua to crash, Roberto Ierusalimschy
- Re: Specially crafted binary chunks can cause Lua to crash, Peter Cawley
- Re: Specially crafted binary chunks can cause Lua to crash, Roberto Ierusalimschy
- Re: Specially crafted binary chunks can cause Lua to crash, Peter Cawley
- Re: Specially crafted binary chunks can cause Lua to crash, Greg Falcon
- Re: Specially crafted binary chunks can cause Lua to crash, Luiz Henrique de Figueiredo
- Re: Specially crafted binary chunks can cause Lua to crash, Ben Sunshine-Hill
- Re: Specially crafted binary chunks can cause Lua to crash, Luiz Henrique de Figueiredo
- Re: Specially crafted binary chunks can cause Lua to crash, Luiz Henrique de Figueiredo
- Re: Specially crafted binary chunks can cause Lua to crash, David Given
- Re: Specially crafted binary chunks can cause Lua to crash, Ralph Hempel