Re: private functions
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Sat, 31 May 2008 12:49:01 -0400
Ronald Bruck wrote:
.... snip ...
Sigh. It's been awhile since I've programmed in C, but I'm SURE
that you can have a function whose scope is purely within another
function. Yet here I have a program which compiles without a peep
under gcc4.2.1 (with -ansi -Wall, no less), AND runs correctly,
but which icc (10.1.015) won't touch with a ten-foot-pole:
Now, I've read this group before, and I know I'm going to get
reamed for such a simple question, but: what's wrong? And why
does one compiler pass it and the other doesn't?
Because you were using a non-standard extension of gcc. Local
functions are forbidden in standard C. If you run gcc properly
(with gcc -W -Wall -ansi -pedantic) so that it restricts itself to
standard C, it will reject that program too.
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
** Posted from http://www.teranews.com **
.
- Follow-Ups:
- Re: private functions
- From: Harald van Dijk
- Re: private functions
- References:
- private functions
- From: Ronald Bruck
- private functions
- Prev by Date: Re: strtok question
- Next by Date: Re: error handlling in recursive function
- Previous by thread: Re: private functions
- Next by thread: Re: private functions
- Index(es):
Relevant Pages
|