Re: Header files with enums instead of defines?

From: Greg 'groggy' Lehey (grog_at_FreeBSD.org)
Date: 12/22/04

  • Next message: Garance A Drosihn: "Re: Header files with enums instead of defines?"
    Date: Wed, 22 Dec 2004 12:33:08 +1030
    To: Brian Fundakowski Feldman <green@FreeBSD.org>
    
    
    

    On Tuesday, 21 December 2004 at 20:43:14 -0500, Brian Fundakowski Feldman wrote:
    > On Wed, Dec 22, 2004 at 11:31:43AM +1030, Greg 'groggy' Lehey wrote:
    >> Has anybody thought about replacing #defines with enums in header
    >> files? It would make debugging a whole lot easier. Foe example, I'm
    >> currently looking at a debug printout which contains:
    >>
    >> xerrno = 17,
    >>
    >> To find out what that means, I need to go to
    >> /usr/src/include/sys/errno.h and look for 17. I find:
    >>
    >> #define EEXIST 17 /* File exists */
    >>
    >> If we were to change this to
    >>
    >> enum EEXIST = 17; /* File exists */
    >>
    >> I'd then be able to see:
    >>
    >> xerrno = EEXIST,
    >>
    >> That makes debugging a whole lot easier. About the only down side I
    >> can see is that you can't #undef an enum. Is this a big deal?
    >
    > I think you'll screw up an awful lot of people that #ifdef based upon
    > the errno names.

    *sigh* Yes, I didn't think about that. Never mind.

    Greg

    --
    See complete headers for address and phone numbers.
    
    



  • Next message: Garance A Drosihn: "Re: Header files with enums instead of defines?"

    Relevant Pages

    • Header files with enums instead of defines?
      ... Has anybody thought about replacing #defines with enums in header ... It would make debugging a whole lot easier. ... currently looking at a debug printout which contains: ...
      (freebsd-arch)
    • Re: Header files with enums instead of defines?
      ... > Has anybody thought about replacing #defines with enums in header ... It would make debugging a whole lot easier. ... Foe example, I'm ...
      (freebsd-arch)
    • Re: No source visible in debugger
      ... I don't think 9.6 changed anything with debugging. ... when I could no longer debug. ... >> some cases I've combined code from several sample plugins. ... >> in more header includes that are typically found in the sample plugins. ...
      (comp.sys.mac.programmer.codewarrior)
    • Re: ASP fails to import typelib using METADATA tag when debugging
      ... If you put the constants the enums in the page you are accessing then by rights you should get an error that the values are redefined. ... If not then the global.asa is not being read during the debugging. ... > On my Windows 2003 machine, using the latest version of IIS, when I turn on server side debugging and attach a debugger the enums I have defined in a type library are no longer recognized in ASP. ...
      (microsoft.public.inetserver.asp.general)
    • Re: How to decipher a large program.
      ... I'm sort of at a loss on where to start to see how it ... works.The program has 3 c files and 4 header files. ... diagram to see how these functions interact. ... Starting from "main" can be useful, so can starting by debugging. ...
      (comp.programming)