* Function call
@ 2006-03-01 5:24 Subbulakshmi Sadagopal (RBIN/EDS2) *
2006-03-01 7:39 ` wwp
0 siblings, 1 reply; 6+ messages in thread
From: Subbulakshmi Sadagopal (RBIN/EDS2) * @ 2006-03-01 5:24 UTC (permalink / raw)
To: Linux C Programming List
Hello,
I have a doubt regarding the following code. There is a void function
funckey().
void funckey()
{
;
}
void main()
{
funckey;
funckey();
}
During execution, the second statement calls the function funckey().
What does the compiler do in the first statement funckey?
Thanks in advance,
Subbulakshmi Sadagopal
^ permalink raw reply [flat|nested] 6+ messages in thread* RE: Function call
@ 2006-03-01 10:47 Honnavalli_Sreevathsa
2006-03-01 10:54 ` Shriramana Sharma
0 siblings, 1 reply; 6+ messages in thread
From: Honnavalli_Sreevathsa @ 2006-03-01 10:47 UTC (permalink / raw)
To: linux-c-programming
The statement
funckey;
does not have any effect and the compiler does not generate any extra
assembly code for it. You are just mentioning a valid symbol name in your
program without assigning it to any other variable, which the compiler deems
as 'not wrong'. You can compile your program with -Wall option to see a
warning message saying this.
Sreevathsa
> -----Original Message-----
> From: linux-c-programming-owner@vger.kernel.org
> [mailto:linux-c-programming-owner@vger.kernel.org]
> Sent: Wednesday, March 01, 2006 10:54 AM
> To: Linux C Programming List
> Subject: Function call
>
>
> Hello,
>
> I have a doubt regarding the following code. There is a void function
> funckey().
>
> void funckey()
> {
> ;
> }
>
> void main()
> {
> funckey;
> funckey();
> }
>
> During execution, the second statement calls the function funckey().
>
> What does the compiler do in the first statement funckey?
>
> Thanks in advance,
> Subbulakshmi Sadagopal
>
> -
> To unsubscribe from this list: send the line "unsubscribe
> linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: Function call
2006-03-01 10:47 Honnavalli_Sreevathsa
@ 2006-03-01 10:54 ` Shriramana Sharma
2006-03-01 11:02 ` wwp
0 siblings, 1 reply; 6+ messages in thread
From: Shriramana Sharma @ 2006-03-01 10:54 UTC (permalink / raw)
To: Linux C Programming List
Wednesday, 01 March 2006 16:17 samaye, Honnavalli_Sreevathsa@emc.com alekhiit:
> The statement funckey; 'not wrong'.
> You can compile your program with -Wall option to see a warning message
> saying this.
fk.c:8: warning: statement with no effect
--
Tux #395953 resides at http://samvit.org
playing with KDE 3.51 on SUSE Linux 10.0
$ date [] CCE +2006-03-01 W09-3 UTC+0530
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Function call
2006-03-01 10:54 ` Shriramana Sharma
@ 2006-03-01 11:02 ` wwp
2006-03-01 16:39 ` Glynn Clements
0 siblings, 1 reply; 6+ messages in thread
From: wwp @ 2006-03-01 11:02 UTC (permalink / raw)
To: linux-c-programming
[-- Attachment #1: Type: text/plain, Size: 565 bytes --]
Hello Shriramana,
On Wed, 1 Mar 2006 16:24:04 +0530 Shriramana Sharma <samjnaa@gmail.com> wrote:
> Wednesday, 01 March 2006 16:17 samaye, Honnavalli_Sreevathsa@emc.com
> alekhiit:
>
> > The statement funckey; 'not wrong'.
> > You can compile your program with -Wall option to see a warning message
> > saying this.
>
> fk.c:8: warning: statement with no effect
I'm not sure w/ gcc, but a "statement with no effect" might not mean that the
statement isn't compiled and generates code.. that will have no effect ;-).
Regards,
--
wwp
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Function call
2006-03-01 11:02 ` wwp
@ 2006-03-01 16:39 ` Glynn Clements
0 siblings, 0 replies; 6+ messages in thread
From: Glynn Clements @ 2006-03-01 16:39 UTC (permalink / raw)
To: linux-c-programming
wwp wrote:
> > > The statement funckey; 'not wrong'.
> > > You can compile your program with -Wall option to see a warning message
> > > saying this.
> >
> > fk.c:8: warning: statement with no effect
>
> I'm not sure w/ gcc, but a "statement with no effect" might not mean that the
> statement isn't compiled and generates code.. that will have no effect ;-).
Without optimisation, it might generate some code (e.g. putting the
value funckey into a register). With optimisation, wouldn't expect any
code to be generated.
--
Glynn Clements <glynn@gclements.plus.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-03-01 16:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-01 5:24 Function call Subbulakshmi Sadagopal (RBIN/EDS2) *
2006-03-01 7:39 ` wwp
-- strict thread matches above, loose matches on Subject: below --
2006-03-01 10:47 Honnavalli_Sreevathsa
2006-03-01 10:54 ` Shriramana Sharma
2006-03-01 11:02 ` wwp
2006-03-01 16:39 ` Glynn Clements
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 NNTP newsgroup(s).