In my implementation [of VLA parameters] I had a REAL sizeof that will return the actualAn implementation of sizeof that returns something other than the size of the pointer when given a VLA parameter violates the fundamental rules of C pointer arithmetic. You cannot pass an array to a function in C, except by wrapping a struct or union around it. Confusingly, C allows you to write function parameters that -appear- to be arrays, e.g.
size. I was told to replace it, but I think I will not.
On Saturday, August 18, 2012 at 5:33:19 AM UTC-7, jacob navia wrote:[...]
In my implementation [of VLA parameters] I had a REAL sizeof that will return the actual
size. I was told to replace it, but I think I will not.
An implementation of sizeof that returns something other than the size
of the pointer when given a VLA parameter violates the fundamental
rules of C pointer arithmetic.
void f(int n, int a[n])
We can say ++a inside the function.
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 991 |
Nodes: | 10 (0 / 10) |
Uptime: | 81:36:34 |
Calls: | 12,949 |
Calls today: | 3 |
Files: | 186,574 |
Messages: | 3,264,673 |