* FW: Complier not giving warning/error in this scenario.. Please help..
@ 2005-09-29 3:05 Soujanya Gundlapalli
2005-09-29 17:47 ` Ian Lance Taylor
0 siblings, 1 reply; 2+ messages in thread
From: Soujanya Gundlapalli @ 2005-09-29 3:05 UTC (permalink / raw)
To: gcc-help; +Cc: gcc-bugs
Hello All,
I am trying to compile the file with the following code.
Originally it was:
if ((erc = pk_val(pline, pkt, mp, PKT_CLEAR, PK_LOCAL))
By accident I saved the file with the following code.
if ((erc = (pline, pkt, mp, PKT_CLEAR, PK_LOCAL))
By accident pk_val_call got deleted and when I complied the above code
using the options
cc -c -g, it got compiled successfully. I tried removing -g also. Even
then it gave success. Is this a problem with the compiler? Is there a
fix for this that I can use.
Appreciate your help.
Regards
Soujanya
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: FW: Complier not giving warning/error in this scenario.. Please help..
2005-09-29 3:05 FW: Complier not giving warning/error in this scenario.. Please help Soujanya Gundlapalli
@ 2005-09-29 17:47 ` Ian Lance Taylor
0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2005-09-29 17:47 UTC (permalink / raw)
To: Soujanya Gundlapalli; +Cc: gcc-help
"Soujanya Gundlapalli" <souj@packetware.com> writes:
> I am trying to compile the file with the following code.
>
> Originally it was:
> if ((erc = pk_val(pline, pkt, mp, PKT_CLEAR, PK_LOCAL))
> By accident I saved the file with the following code.
> if ((erc = (pline, pkt, mp, PKT_CLEAR, PK_LOCAL))
>
> By accident pk_val_call got deleted and when I complied the above code
> using the options
> cc -c -g, it got compiled successfully. I tried removing -g also. Even
> then it gave success. Is this a problem with the compiler? Is there a
> fix for this that I can use.
You are using the comma operator. In C or C++ the value of "(a, b)"
is to evaluate "a", and then to return the value of "b". This is only
generally useful if "a" has a side-effect, like a function call. But
it is always legal. So the above code is correct.
If you compile with -Wall, you should get a warning along the lines of
"left-hand operand of comma expression has no effect".
Ian
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-09-29 17:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-29 3:05 FW: Complier not giving warning/error in this scenario.. Please help Soujanya Gundlapalli
2005-09-29 17:47 ` Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).