Re: dev_t / udev_t confusion ?

From: Bruce Evans (bde_at_zeta.org.au)
Date: 06/10/04

  • Next message: Bruce Evans: "Re: dev_t / udev_t confusion ?"
    Date: Thu, 10 Jun 2004 16:32:37 +1000 (EST)
    To: Peter Wemm <peter@wemm.org>
    
    

    On Wed, 9 Jun 2004, Peter Wemm wrote:

    > On Wednesday 09 June 2004 08:55 am, Poul-Henning Kamp wrote:
    > > In message <53993.1086779790@critter.freebsd.dk>, Poul-Henning Kamp
    > writes:
    > > >The change proposed is more or less to do:
    > > > s/dev_t/struct cdev */
    > > > s/udev_t/dev_t/
    > > >over all the kernel sources (366 files or so).
    > >
    > > Looks like a "yea" so far, so I have a couple of follow-up questions:
    >
    > I had a slight preference for 'kdev_t *' in the kernel, but 'struct cdev
    > *' works for me as well so I've changed my mind. No objection from me
    > then.

    This would be a large style bug (more of a design error, but not doing it
    is documented in style(9)):

    %%%
    STYLE(9) FreeBSD Kernel Developer's Manual STYLE(9)

    NAME
         style -- kernel source file style guide
    ...
         Avoid using typedefs for structure types. Typedefs are problematic
         because they do not properly hide their underlying type; for example you
         need to know if the typedef is the structure itself or a pointer to the
         structure. In addition they must be declared exactly once, whereas an
         incomplete structure type can be mentioned as many times as necessary.
         Typedefs are difficult to use in stand-alone header files: the header
         that defines the typedef must be included before the header that uses it,
         or by the header that uses it (which causes namespace pollution), or
         there must be a back-door mechanism for obtaining the typedef.
    %%%

    Bruce
    _______________________________________________
    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: Bruce Evans: "Re: dev_t / udev_t confusion ?"

    Relevant Pages

    • Re: dev_t / udev_t confusion ?
      ... No objection from me ... Avoid using typedefs for structure types. ... that defines the typedef must be included before the header that uses it, ...
      (freebsd-arch)
    • Re: typedef usage
      ... I was reading a coding style adopted in FreeBSD (and I believe in other ... "Avoid using typedefs for structure types. ... Typedefs are difficult to use in stand-alone header files: ... this issue is "fixable" (mostly it would be to clean up libraries ...
      (comp.lang.c)
    • Re: Same-name typedefS in separate translation units
      ... and both are wrapped in typedefS with identical names as follows ... have an appropriate newsgroups line in your header for your mail to be seen, ... or the newsgroup name in square brackets in the subject line. ...
      (comp.lang.c.moderated)
    • Re: Specific sizes of variable types
      ... > definite sizes for integers(2 byte integers and 4 byte longs). ... C99 has a standard header called, which provides typedefs ...
      (comp.lang.c)
    • Re: Specific sizes of variable types
      ... stdint.h and saw all these typedefs. ... What happens if you user signed char or unsigned char for ... > C99 has a standard header called, ...
      (comp.lang.c)