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: | 1,075 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 86:02:09 |
| Calls: | 13,797 |
| Files: | 186,989 |
| D/L today: |
3,775 files (1,120M bytes) |
| Messages: | 2,438,058 |