This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Problem with using "pEdge==NULL"


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]