10 ms·
I believe that works fine (at least in C). You have to statically put the array size into the function signature, so it will only work on arrays of that size. I
by habitue 12y ago
I believe that works fine (at least in C). You have to statically put the array size into the function signature, so it will only work on arrays of that size. I was simply pointing out the difference between dependently typed vectors which have the type checker prove you use the vector correctly, and arrays in c and pascal whose sizes are known at compile time. I am agreeing with the author that this makes it hard to create generic array bounds if you don't have the ability to make unbounded arrays (as c does). I was disagreeing with the gp, who was conflating these two different sorts of types.
- pjmlp 12y agoSo I guess you aren't confortable with the C standard. Functions don't take arrays size statically in arguments. Whatever you write is ignored.
- ufo 12y agoIIRC, if you have multidimensional arrays only the last dimension is ignored so arr[3][4] is equivalent to arr[3][]. Of course, in the one dimensional case it means that the dimension is ignored.
- habitue 12y agoIt's been a few years since I've written a lot of C. ufo's sibling comment reminded me of how it acts (the last dimension is ignored). Anyway, this is completely beside the point of what I was talking about. The point is that a static size is a very different level of type system machinery from a dynamic size.
- pjmlp 12y agoMy point is that although they are static allocated, the moment you pass them as arguments, they are just another pointer. Which leads to those beautifull security exploits.