Mailing List archive

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

[vdr] Re: lock handling in sections.c



Rainer Zocholl writes:
 > 
 > >I do think (DeviceHasLock = device->HasLock()) is executed every time
 > >the condition is evaluated (i.e. before the last check whether we
 > >bother to wait once more).  I do not have my Stroustrup now at hand so
 > >I cannot check if it is allowed to depend on the order in which the
 > >conditions are written, though.
 > 
 > As long as "(round++ < 20)" is "TRUE" of course
 > "(DeviceHasLock = device->HasLock())==false)"
 > will be executed to.
 > 
 > You should never "assume" any timing order a programs runs just
 > because you wrote it this way in C...
 > Modern compilers may change the execution order...

Then they are faulty :)

My Stroustrup (2nd edition, though) notes at page 505, paragraph
r.5.14 that "Unlike &, && guarantees left to right evaluation; ..."

yours,
		Jouni




Home | Main Index | Thread Index