On Fri, Jul 27, 2012 at 7:24 PM, Stefan Stavrev <[email protected]> wrote:
> I can compute the size with sizeof. I don't like passing array size as
> separate parameter, which is one of the reasons I used vectors in the
> beginning.
>
Perhaps I am misunderstanding what you are planning on doing, but you
may run into difficulties with this. Maybe this simple test will
explain the difficulties better than I can. If the difficulties that
this test demonstrates don't apply to your plan, maybe you could
explain a bit more?
#include <stdio.h>
#include <stdlib.h>
void report(int array[]) {
printf("Size = %d\n", (int) sizeof(array) );
}
int main(void) {
int arrA[] = {1,2,3};
int arrB[] = {1,2,3,4,5,6};
int *arrC = malloc(50*sizeof(int));
report(arrA);
report(arrB);
report(arrC);
return 0;
}
This is what I get running it on my laptop:
~ > gcc test.c -o test
~ > ./test
Size = 8
Size = 8
Size = 8
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org