This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Problem with using "pEdge==NULL"
- From: Jeffrey Holle <jeffreyholle at bellsouth dot net>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 04 Sep 2007 22:04:14 -0400
- Subject: Problem with using "pEdge==NULL"
- Reply-to: jeffreyholle at bellsouth dot net
Using gcc/g++ version 4.1.2
I'm creating an application that attempted to employ the statement:
if(m_future.getEdges().second!=NULL)
the getEdges method is defined as:
typedef std::pair<const DataEdge*,const DataEdge*> Edges;
Edges getEdges(void) const {return
std::make_pair(m_pEdge1,m_pEdge2);}
This statement always considered the second pair element as not NULL.
I've fixed my problem by creating another method:
bool isIntersection(void) const { return (m_pEdge2==NULL) ? true :
false;}
Then "if(!m_future.isIntersection())" works as expected.
It really seems like either should have worked, but only the second did.
I'd like an explanation.