cvs commit: src/include stdlib.h

Matthew Dillon dillon at apollo.backplane.com
Sat Apr 30 09:17:33 PDT 2005


    Lets not turn this into a huge argument, please.

    I'll make my position re: size_t vs int very clear:  size_t should ONLY
    be used for I/O calls that are designed to pass arbitrary pointers to
    the system.  It should NOT be used for calls that expect fairly small
    structures (as in less then 2GB in size).  Where we aren't in conflict
    with some standard, 'int' should be used for such calls. 

    I've said this before and I'll say it again... just because a negative
    value isn't allowed by a procedure call doesn't mean that one must
    necessarily pass an unsigned type to it.  Unsigned types can wreak havoc
    on programs and they unnecessarily restrict the programmer's flexibility.

    For example, a very common practice is to initialize a value to an
    illegal value (such as -1) in order to be able to determine later on
    whether the variable has been set by an option or for some other
    reason.  For example, a procedure that looks something up in an array
    might use -1 to indicate item-not-found.  When you start messing around
    with unsigned types you screw up those kinds of programming methodologies.

    The committee idiots made sizeof() return an unsigned value, and look
    at the mess that has created?  We don't want to repeat the same mistake.

						-Matt





More information about the Commits mailing list