W
William Payne
Consider the following code:
struct foo
{
char* bar;
};
// fooptr is of type foo*
if(fooptr != NULL && fooptr->bar != NULL)
{
cout << fooptr->bar << endl;
}
Is the if-statement safe, meaning it won't try to evaluate fooptr->bar if
fooptr is NULL? Can I make sure it is evaluated from left to right or should
I have nested if-statements instead?
Thanks for any replies
/ William Payne
struct foo
{
char* bar;
};
// fooptr is of type foo*
if(fooptr != NULL && fooptr->bar != NULL)
{
cout << fooptr->bar << endl;
}
Is the if-statement safe, meaning it won't try to evaluate fooptr->bar if
fooptr is NULL? Can I make sure it is evaluated from left to right or should
I have nested if-statements instead?
Thanks for any replies
/ William Payne