473,394 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

gcc warnings

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
4 4351

"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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Kylotan | last post by:
I have the following code: def IntToRandFloat(x): """Given a 32-bit integer, return a float in """ x = int(x) x = int(x << 13) ^ x return...
12
by: Gary | last post by:
Hi! guys, I have a SQL agent job fails because it gets 10 warnings when it runs a stored procedure. These warnings are trivial and can be ignored. Can I make it ignore these warnings and...
3
by: Terry Richards | last post by:
mysql 4.1.9-standard how do i find exactly what the warnings are when i only get Query OK, 1 row affected, 1 warning (0.00 sec) :-)^2
30
by: prasanna | last post by:
i will be very thankful if you sent all the errors and warnings regarding to the language C thank you
22
by: John Fisher | last post by:
void f(int p) { } Many (most?) compilers will report that p is unreferenced here. This may not be a problem as f may have to match some common prototype. Typically pointers to functions are...
2
by: funkyj | last post by:
I've been googling around trying to find the answer to this question but all I've managed to turn up is a 2 year old post of someone else asking the same question (no answer though). ...
6
by: pete142 | last post by:
When I compile this code: typedef unsigned char BYTE; BYTE * IpString(unsigned int ip) { static BYTE ipString; ipString = (BYTE) 0xff & (ip >24); ipString = (BYTE) 0xff & (ip >16);
3
by: gil | last post by:
Hi, I'm trying to find the best way to work with compiler warnings. I'd like to remove *all* warnings from the code, and playing around with the warning level, I've noticed that compiling with...
1
by: billiejoex | last post by:
Hi there, into a module of mine I 'warn' a message if a certain situation occurs: def add_anonymous_user(permissions=('r'): if 'w' in p: import warnings warnings.warn("it's not rencommended...
1
by: Robert Singer | last post by:
Platform: winXP, excel 2003 Python 2.5.2 XLWriter 0.4a3 (http://sourceforge.net/projects/pyxlwriter/) Is anyone here using this very nice package, for writing excel files? I'm using it on...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.