Quote:
|
Originally Posted by fp_unit
Really. Do a sizeof(bool) and a sizeof(bool*) and I guarantee they're the same size.
|
That depends on your compiler. As far as I know, all that is guaranteed about the size of a bool is:
1 =< sizeof(bool) =< sizeof(long)
Even then, that doesn't mean all compilers stick to that
Also, the size of a pointer isn't always 32-bit, that too depends on the platform.
It's quite possible that the size of a bool is smaller than the size of a pointer. Your point of course still stands. In fact, at least for performance reasons there's little reason to pass anything like bool, long, int, char, etc by pointer. It's probably even slower, since you need to dereference the pointer.
Related to that subject, if you don't modify strings, you generally want to pass them as
const std::string &