
3 Sep
2007
3 Sep
'07
1:05 p.m.
David A. Greene wrote:
Bo Persson wrote:
:: &a[0]; :: :: The C++ community promotes std::vector as a C array replacement, :: but :: it's really not because it's not legal to do the above operation :: when :: the vector is empty.
That's just a misuse of the std::vector. You never, ever get the idea of taking the address of an empty array. Why attempt that on an empty vector??
Dunno what you mean by "get the idea of taking the address," but this is a perfectly reasonable thing to do in C. In llvm, there are many interfaces that want, for example:
foo(int *array, int num)
I think the crux of the issue is why "there are many interfaces" taking raw pointers of any kind? Jeff Flinn