By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,191 Members | 740 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,191 IT Pros & Developers. It's quick & easy.

gcc warnings

P: n/a
Dear all,

The following coding have two warnings in GCC, could you please figure
it out for me? Thank you very much !

602 : EdgePair *p1, *p2, *p3;
603 :
604 : //
605 : if (ES_sanityCheck(e1,e2))
606 : p1 = new EdgePair(e1, e2);
607 : if (ES_sanityCheck(e2,e3))
608 : p2 = new EdgePair(e2, e3);
609 : if (ES_sanityCheck(e1,e3))
610 : p3 = new EdgePair(e1, e3);
611 :
612 : //
613 : //
614 : if (p1 && p2 && p3){
615 : bool ret = ES_sanityCheck(p1, p2) &&
616 : ES_sanityCheck(p1, p3) &&
617 : ES_sanityCheck(p2, p3);
618 :
619 : delete p1, p2, p3;
620 : return ret;
621 : }
619: warning: right-hand operand of comma has no effect
619: warning: right-hand operand of comma has no effect

Jun 26 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a

"asdf" <li*********@gmail.com> wrote in message
news:11*********************@c74g2000cwc.googlegro ups.com...
Dear all,

The following coding have two warnings in GCC, could you please figure
it out for me? Thank you very much !

602 : EdgePair *p1, *p2, *p3;
603 :
604 : //
605 : if (ES_sanityCheck(e1,e2))
606 : p1 = new EdgePair(e1, e2);
607 : if (ES_sanityCheck(e2,e3))
608 : p2 = new EdgePair(e2, e3);
609 : if (ES_sanityCheck(e1,e3))
610 : p3 = new EdgePair(e1, e3);
611 :
612 : //
613 : //
614 : if (p1 && p2 && p3){
615 : bool ret = ES_sanityCheck(p1, p2) &&
616 : ES_sanityCheck(p1, p3) &&
617 : ES_sanityCheck(p2, p3);
618 :
619 : delete p1, p2, p3;
delete p1;
delete p2;
delete p3;

or

delete p1, delete p2, delete p3;

Otherwise p2 is just doing nothing whatsoever.
620 : return ret;
621 : }
619: warning: right-hand operand of comma has no effect
619: warning: right-hand operand of comma has no effect

Jun 26 '06 #2

P: n/a
In article <11*********************@c74g2000cwc.googlegroups. com>,
li*********@gmail.com says...

[ ... ]
619 : delete p1, p2, p3;
620 : return ret;
621 : }
619: warning: right-hand operand of comma has no effect
619: warning: right-hand operand of comma has no effect


The delete expression takes only one operand, so to delete all three
of these, you need:

delete p1;
delete p2;
delete p3;

--
Later,
Jerry.

The universe is a figment of its own imagination.
Jun 26 '06 #3

P: n/a
thanks man.

Jerry Coffin wrote:
In article <11*********************@c74g2000cwc.googlegroups. com>,
li*********@gmail.com says...

[ ... ]
619 : delete p1, p2, p3;
620 : return ret;
621 : }
619: warning: right-hand operand of comma has no effect
619: warning: right-hand operand of comma has no effect


The delete expression takes only one operand, so to delete all three
of these, you need:

delete p1;
delete p2;
delete p3;

--
Later,
Jerry.

The universe is a figment of its own imagination.


Jun 26 '06 #4

P: n/a
thanks.

Jim Langston wrote:
"asdf" <li*********@gmail.com> wrote in message
news:11*********************@c74g2000cwc.googlegro ups.com...
Dear all,

The following coding have two warnings in GCC, could you please figure
it out for me? Thank you very much !

602 : EdgePair *p1, *p2, *p3;
603 :
604 : //
605 : if (ES_sanityCheck(e1,e2))
606 : p1 = new EdgePair(e1, e2);
607 : if (ES_sanityCheck(e2,e3))
608 : p2 = new EdgePair(e2, e3);
609 : if (ES_sanityCheck(e1,e3))
610 : p3 = new EdgePair(e1, e3);
611 :
612 : //
613 : //
614 : if (p1 && p2 && p3){
615 : bool ret = ES_sanityCheck(p1, p2) &&
616 : ES_sanityCheck(p1, p3) &&
617 : ES_sanityCheck(p2, p3);
618 :
619 : delete p1, p2, p3;


delete p1;
delete p2;
delete p3;

or

delete p1, delete p2, delete p3;

Otherwise p2 is just doing nothing whatsoever.
620 : return ret;
621 : }
619: warning: right-hand operand of comma has no effect
619: warning: right-hand operand of comma has no effect


Jun 26 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.