JKop wrote:
What the hell ever happened to the whole concept of POD?
Plain Ol' Data
PLAIN OL' DATA!
When I have the likes of:
struct Blah
{
int a;
double b;
int* p_k;
float** p_p_f;
};
I should be able to set it to whatever the hell I please!
PODs aren't types of the 60s era, but of the C90 era.
Checking a pointer to see if it has a valid value (and perhaps throwing an
exception if not) is complete and utter total bullshit. It's inefficient
too. If I wanted such a mechanism, I'd explicitly ask for it:
int* k = ...
CheckPointer(k) ;
I'd like some clarity on the issue. Will the following behave identically on
all implementations , ie. will it output "I'm not a shit implementation! " on
all platforms?:
int main()
{
bool* p_boolean = reinterpret_cas t<bool* const>(92729);
std::cout << "I'm not a **pepper** implementation! ";
}
The above never causes side effects. Assignment of an integer to a
pointer type results in implementation defined behaviour, as far as you
do not dereference it.
"1.3.5 implementation-defined behavior
behavior, for a well-formed program construct and correct data, that
depends on the implementation and that each implementation shall document."
This means that you will never get unexpected effects for that.
On the other hand, pointing with a pointer to an invalid object (usually
with pointer arithmetic), results in undefined behaviour.
--
Ioannis Vranos
http://www23.brinkster.com/noicys