This should never work but it does. Why?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: TVR Fan (TVRFan_at_discussions.microsoft.com)
Date: 12/21/04


Date: Tue, 21 Dec 2004 06:59:02 -0800

I've just fixed what should be a bug in a simple function to log a message to
a file. The thing is, the original code worked!

    Protected Sub LogMessage(ByVal filename As String, ByVal message As
String)
        Dim fileNum As Integer

        fileNum = FreeFile()
        FileSystem.FileOpen(FreeFile(), filename, OpenMode.Append)
        FileSystem.PrintLine(fileNum, DateTime.Now.ToString + " - " + message)
        FileSystem.FileClose(fileNum)
    End Sub

I'm opening the file with one number and then using a different file number
to write the data! Surely the PrintLine and the FileClose should fail. But
the application works and logs mesages to the log file with no problems.

Can anyone explain?

--- Al.



Relevant Pages

  • coreutils-6.11 released
    ... 300 in gnulib. ... you can run this command ... -fR to copy a fifo or "special" file onto an existing file would fail ... [bug introduced in coreutils-5.90] ...
    (gnu.announce)
  • Re: embedded in strings
    ... This looks like a bug. ... out why the index is causing this to fail. ... | queries with vaues longer than the column being queried. ... |> | query analyzer if you want to see what I'm talking about. ...
    (microsoft.public.sqlserver.ce)
  • powerpc: fork && stepping (Was: [RFC,PATCH 0/14] utrace/ptrace)
    ... FAIL: step-fork ... I din't mention this patch in this series because this bug ... The patch doesn't seem to fix the issue on powerpc: ... Good to know, thanks again Ananth. ...
    (Linux-Kernel)
  • Re: how many bugs do you find and correct during TDD?
    ... > first you write a test you expect to fail. ... If it is not as expected, is that a bug, an imporperly written ... > request, or the request itself was the result of a misunderstanding of the ...
    (comp.object)
  • Re: Possible shared mapping bug in 2.4.23 (at least MIPS/Sparc)
    ... > Don't blame the kernel - the kernel is only doing what the user asked it ... Surely it's better to fail the mmapon other archs ... It's a bug either way ... ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)