-
June 4th, 2010, 05:49 PM
#1
cstddef
I was trying to figure out what this header actually does, as it doesn't wrap anything around std namespace, or any new typedefs etc...
GCC implements it like this:
Code:
#ifndef _GLIBCXX_CSTDDEF
#define _GLIBCXX_CSTDDEF 1
#pragma GCC system_header
#include <stddef.h>
namespace std
{
using ::ptrdiff_t;
using ::size_t;
}
#endif
What exactly is the point of this?
I suppose it is for more than just the joy of writing a fancier std::size_t instead of the boring size_t, right?
The only reason I could maybe imagine is for some sort of Koenig resolution, if an ill advised user defined his own size_t in his own namespace? But even in this case, I don't think this would be necessary, as stl function would still resolve with the global size_t.
I may be looking too hard into this, but I also think the comity did it for the lulz. And I'm not one to give up on a C++ mystery.
Is your question related to IO?
Read this C++ FAQ article at parashift by Marshall Cline. In particular points 1-6.
It will explain how to correctly deal with IO, how to validate input, and why you shouldn't count on "while(!in.eof())". And it always makes for excellent reading.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|