sizeof(list) will return the size of the pointer and not the size of the block it's pointing at.
It's also bad to assume there's no compiler padding etc by doing pointer arithmetic unless it's byte aligned. If the type changes then you code breaks.
Usually, unless you're designing for supercomputer high performance or embedded system efficiency, then you'll not need to stray away from the standard libraries.
I was just trying to avoid vectors to keep the library portable to C, but when I think about it C has very limited use these days anyway. Vectors it is!
I was just trying to avoid vectors to keep the library portable to C, but when I think about it C has very limited use these days anyway. Vectors it is!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.