Alexander Stohr wrote:

 >
 > possibly i am thinking a bit more practical: - the number of pages
 > should never go negative, so why do we need the sign? - there is no
 >  reason why the number of pages should get limited to i.e. 2 GB
 > instead of 4 GB on 32 bit machines.


I think Phil *meant* 'unsigned int' instead of 'int' :-)


 > - you are right in trying to distinguish number_of_bytes and 
number_of_elements
 >

 > by meance of different type defines for them. - i am not aware of a
 > better type define - you might want to suggest a new one.
 >
 > Suggestion:  typedef unsigned int    elcount_t; or   #define elcount_t       
 >      unsigned int
 >
 > But to proove you the opposite: void *calloc(size_t nmemb, size_t
 > size); nmemb => number_of_elements size => number_of_bytes (per
 > element of course)
 >
 > so the usage is already a bit puzzled for other central areas. don't
 >  blame the agpgart programmers for introducing this...
 >
 >

Yep, that's true... So using 'size_t' for element count seems to be a 
rather common thing (though 'calloc' is the only example I found so far 
;-). The alternative of using another #define might make the code more 
readable, but we may also stick to the existing version and just add a 
few comments, s.t. people using it are not puzzled by the signification 
of the value.
BTW, is 'size_t' an 'unsigned int' on every 32-bit platform ? and on the 
64-bit ones ? Anyone knows about that ?

a+

-- 
Nicolas Aspert      Signal Processing Laboratory (LTS)
Swiss Federal Institute of Technology (EPFL)


_______________________________________________
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to