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

Re: cvs commit: src/lib/libc/sys tls.2


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 21 Mar 2005 14:10:30 -0800 (PST)

:    The poin is, guys, that sizeof(some_ridiculously_large_structure_or_array_
:    which_is_as_large_as_the_processes_entire_address_space) is just plain
:    ridiculous, and sizeof() should not have been made to return size_t
:    for something so silly.  They could have added a usizeof() for the one
:    in a million chance that someone actually needed something like that,
:    but no... the idiots on the standard committee seem to believe that
:    sizeof() is only EVER used in calls to read() or write(), verses, say,
:    in generic exprssions that might, say, calculate an array index.
:
:    for (i = 0; i < sizeof(ary)/sizeof(ary[0]); ++i) ...   now, should i
:    be unsigned here, or an int?  it should be an int, plain and simple,
:    for 99.99999% of the programs ever written.
:
:    For the same reason, a TLS segment that is the size of the entire
:    address space (or even 1/2 the entire address space), is also ridiculous.
:
:					-Matt

   Sorry, I'm going down a rabbit hole here.  What I REALLY meant to say
   was that it should be signed... i.e. an int or a long, rather then 
   unsigned.  In the case of sizeof() I have to agree with chris... it
   should be an 'int' if it is small enough to fit, and a 'long' otherwise,
   and overflow values should not be allowed (generate a compile time error)
   or there should be separate keyword, like usizeof(), which returns the
   value as unsigned.

					-Matt
					Matthew Dillon 
					<dillon@xxxxxxxxxxxxx>



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