Re: private functions



Ronald Bruck wrote:

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:

.... snip ...

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 **
.



Relevant Pages

  • Re: Next ISO C standard - any features being removed?
    ... operator overloading in C. ... but that is not a C standard issue. ... If you mean by self hosting an implementation that compiles itself, ... they too will be automatically generated with target properties ...
    (comp.std.c)
  • Re: Features and standards
    ... to the ANSI-C standard, compiles under 'gcc' but not under Sun Studio. ... struct name { ... and then did some tricky allocation to make the namestr array ...
    (comp.lang.c)
  • Re: did man walk on the moon...and creationism.
    ... scope in the right direction. ... Standard stuff, man, standard stuff. ... that, and set the system to take pix as necessary, and review the pix in the ... astronomers kept a close eye on all the Apollo missions. ...
    (talk.origins)
  • Re: did man walk on the moon...and creationism.
    ... scope in the right direction. ... Standard stuff, man, standard stuff. ... that, and set the system to take pix as necessary, and review the pix in the ... astronomers kept a close eye on all the Apollo missions. ...
    (talk.origins)
  • Re: did man walk on the moon...and creationism.
    ... scope in the right direction. ... Standard stuff, man, standard stuff. ... that, and set the system to take pix as necessary, and review the pix in the ... astronomers kept a close eye on all the Apollo missions. ...
    (talk.origins)