Loading ...
Sorry, an error occurred while loading the content.

RE: [XP] OT Re: Ignoring exceptions

Expand Messages
  • Dinwiddie, George
    Ever written code that tested the return value of every printf (and family) call? I actually looked at doing that once, in a PC program. Report generators,
    Message 1 of 1 , Jan 16, 2001
    • 0 Attachment
      Ever written code that tested the return value of every printf (and
      family) call?

      I actually looked at doing that once, in a PC program. Report generators,
      which could have code nested arbitrarily deep, used fprintf to write to
      the printer. To detect something like the printer out of paper, you had
      to test the printf and see if it failed. UGLY.

      I created a prprintf (printer printf) that did this testing and, if fprintf
      returned a value less than one, did a longjump to a point set up when
      the print job was opened. In effect, I created my own exception system.

      (Actually, there was some other magic in there too, to allow the operator
      to add paper and continue the job, but this was very tricky due to the
      condition of the stack in DOS when this stuff happened. You actually
      had to trap an interrupt if you wanted to continue without either losing
      or duplicating some output.)

      I prefer the Java exception system.

      - George

      -----Original Message-----
      From: Robert Sartin [mailto:sartin@...]
      [snip]
      To argue for checked exceptions: imagine if all the code that
      communicates over sockets had to explicitly inspect the status of the
      connection before and after every I/O operation. Ever worked with C/C++
      code that ignores the return value of write?

      Regards,

      Rob
    Your message has been successfully submitted and would be delivered to recipients shortly.