Time-of-check to time-of-use: Difference between revisions

Content deleted Content added
Alinowe (talk | contribs)
EAFP doesn't have to be signaled by exceptions, it can be signaled just fine by error codes. It does assume the check is included in the "protected" API, but that's a design issue.
Line 127:
== Preventing TOCTOU ==
 
Despite conceptual simplicity, TOCTOU race conditions are difficult to avoid and eliminate. One general technique is to use [[exceptionerror handling]] instead of pre-checking, under the philosophy of EAFP – "It is easier to ask for forgiveness than permission" rather than LBYL – "look before you leap" – in this case there is no check, and failure of assumptions to hold are detectedsignaled atby usean time,error by anbeing exceptionreturned.<ref>{{cite book
| last=Martelli
| first=Alex