DragonFly BSD
DragonFly commits List (threaded) for 2005-04
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: cvs commit: src/include stdlib.h

From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 30 Apr 2005 09:16:23 -0700 (PDT)

    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.


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]