Thread: Robust error handling

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Memloop View Post
    strcmp can return negative values. From the man page:
    Oops! Okay. Well, this is a good place for errno then. Except, AFAICT, strcmp() does not provide any error checking, because the compiler will in fact catch a "bad argument", and nothing else would constitute an error here. An example of how the need for this can be illusory.

    Vis, thread safety, I would assume that is what the GL model (using a callback to fetch errors) is intended to insure.

    Again, these things only seem like hassles if you are determined to check every single function call you make, and leave this (absurdly paranoid) error checking in place permanently. If you just need to track down an issue, or leave some key checks in place, it is very simple and works well.

    Hopefully someone will be along to explain why I am out to lunch again
    Last edited by MK27; 12-19-2009 at 01:18 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Robust error checking
    By Memloop in forum C++ Programming
    Replies: 4
    Last Post: 09-21-2009, 10:45 AM
  2. Robust method for storing data outside of a program
    By goatslayer in forum C++ Programming
    Replies: 17
    Last Post: 09-19-2007, 03:08 PM