Re: Header files with enums instead of defines?

From: M. Warner Losh (imp_at_bsdimp.com)
Date: 12/22/04

  • Next message: Kris Kennaway: "Re: Forcefully unmounting devfs..."
    Date: Wed, 22 Dec 2004 11:51:55 -0700 (MST)
    To: scottl@freebsd.org
    
    

    In message: <41C9C015.7050706@freebsd.org>
                Scott Long <scottl@freebsd.org> writes:
    : M. Warner Losh wrote:
    : > In order to gain the benefits of the enums, errno would need to be an
    : > enum errno_t or some such. This breaks C++ code that sets errno = 0,
    : > since you can't assign integers to errno values.
    : >
    : > So even if you retained EBOGUS or whatever, this wouldn't work with
    : > C++. errno has to be an int to work there.
    : >
    : > Warner
    :
    : I think you might have missed that nothing was actually being declared
    : with the errno_t type, but rather the type was used as a cast for gdb.
    : It's a neat trick, but still a little cumbersome unless gdb was taught
    : about it or given some clever macros.

    Or better yet, just use the array of error values already compiled
    into the programs that strerror() formats for you (you don't need to
    use strerror, just sys_errlist[]).

    Warner
    _______________________________________________
    freebsd-arch@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-arch
    To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"


  • Next message: Kris Kennaway: "Re: Forcefully unmounting devfs..."

    Relevant Pages