955 reputation
511
bio website
location
age
visits member for 3 years, 11 months
seen Dec 21 at 20:38

Sep
19
comment Functions with side-effects in Delphi/Pascal
let us continue this discussion in chat
Sep
19
comment Functions with side-effects in Delphi/Pascal
@JohnFisher: I have no problem with DeleteFile throwing an exception on failure. My argument was with your attempt to somehow enforce a distinction between an exceptional and non-exceptional failure, without some application-specific rules (clearly such rules are easy to think of, for example "failure because the file doesn't exist is non-exceptional and can be ignored; failure because you have incorrect file permissions is exceptional and should be reported to the user", but equally clearly, those rules do not belong at the level of a DeleteFile library function itself)
Sep
19
comment Functions with side-effects in Delphi/Pascal
@John Fisher: Whether failure to delete a file is exceptional depends on the context. I believe a better suggestion is to have two functions: TryDeleteFile that returns a success/failure value, and DeleteFile which returns nothing but throws an exception on failure. Then you can use whichever is appropriate in the context, which is not something that is known by those functions.
Sep
19
comment Functions with side-effects in Delphi/Pascal
This is usually a bad idea: now you have two code paths (if CanDeleteFile returns false, and if DeleteFile throws an exception) for one logical situation (the file could not be deleted). And you must handle the possible exception from DeleteFile, because your application is running concurrently with other applications that can modify the file-system (for example, another application could rename the file between your call to CanDeleteFile and DeleteFile).
Jun
29
comment Why do game developers prefer Windows?
@Marcelo: Most gamers have abandoned PC gaming and gone to xbox or playstation.
Jun
21
comment Can I migrate a clone of Google Code repository into Github?
@David: I'm sorry to hear that. I hope Irae's answer lead you to a working solution.
Jun
17
comment Based on what I read in “Inside the Machine”, is this approach to branches more optimal?
+1: This is correct, and also totally easy to verify: write the code and look at the generated assembly (and yes, I tried it -- even with optimisations turned off the generated assembly is identical except the version with the variable reserves some extra stack space).
Jan
13
comment Why is the warranty disclaimer section of a licence usually (always?) shouted?
@Woot4Moo: The use of "shouted" in the question was an internet colloquialism, it was not intended to be taken literally. I'm amazed anyone needed that to be spelled out (then again maybe you didn't mean your comment to be taken literally either? :P)