From: Sam S. <sd...@gn...> - 2005-01-25 14:47:53
|
Hi Bruno, > * Bruno Haible <oe...@py...t> [2005-01-25 11:53:38 +0100]: > > This function is unusable because underspecified: > > /* bit sequence --> integer */ > global maygc object udigits_to_I (void* digits, uintC len) { > > 1) The documentation should specify details about the input (is 'digits' > pointing to a single object of type void or to multiple ones? digits points to a sequence of bytes, so it should probably be uint8*. > is len > 0 or can it be 0 ? dunno. it depends on the behavior of UDS_to_I() - which is not specified in the comments either. BTW, what does "there must be room for 1 digit below of MSDptr" mean? > Is the input in big-endian or little-endian order?) I don't know what "big-endian" and "little-endian" are. In my kindergarten they taught only one way to record numbers with digits: 123 = 1*100 + 2*10 + 3*1 So, byte sequence "123" represents the integer 1*256^2 + 2*256 + 3*1. > 2) The doc should mention "can trigger GC"! OK (although the "maygc" declaration should be enough, IMO) > 3) In C, a 'void *' designates a pointer to memory of undefined contents. > It's not useful to access such memory. If there is data at *digits, > you need to specify the element size. I guess, "digits" should be "uint8*". > 4) Does the function write to *digits? I don't think so - but UDS_to_I() does not declare its argument const... > If not, then why is the 'digits' pointer not 'const'? because I don't know what "const" means and I am sick of compiler warnings and error triggered by such declarations. > 5) The function is lacking a comment of its own in lispbibl.d. Imagine > how unusable lispbibl.d would be if it contained only function > declarations without comments! right... Maybe you could fix the comments of UDS_to_I() first? -- Sam Steingold (http://www.podval.org/~sds) running w2k <http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/> <http://www.mideasttruth.com/> <http://www.honestreporting.com> There are 10 kinds of people: those who count in binary and those who do not. |