🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3423

Re: Nested functions (was: Re: GOTO single exit point)

#3423
From: J. Kanze
Date: Mon, 18 Sep 1995 08:05
38 lines
2482 bytes
Paul Long (plong@perf.com) wrote:
|> lance@eco.twg.com (Lance Kibblewhite) wrote:
|> >Silly contrived example without using multiple gotos nor nested if
|> >statements.
|> [snip:example using nested functions]

|> Impressive, but scary. This isn't an obfucated-C thread is it? :-)

That was my impression.  First Chris Volpe posts an example of how
returns in the middle of a function can render the function unreadable.
Then someone else posts an example proving that you can make it just as
unreadable (or maybe even more so) using nested if's.  Now we have an
example of how an extension would allow even more creative ways to
obscure what is going on.  Maybe I should post an example in C++, just
to show what obfucation can be in a language designed for it:-).

Seriously (and I hope no one takes offense at the above, as it wasn't
meant to be serious), what would be wrong with the posted examples if
the functions weren't nested, but just static?

|> Makes me
|> glad that C doesn't allow nested functions.

|> >What do you mean 'C' doesn't have local functions!
|> >
|> >Give me a real language with local functions, and a decent optimizer
|> >anyday.

|> Although there are C-like languages that support nested functions, e.g., Gnu C,
|> I've recently learned that the execution model must change to support them. Not
|> a pretty sight.

I'm curious.  In what way must the execution model be changed?
-- 
James Kanze           (+33) 88 14 49 00          email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
Conseils en informatique industrielle--
                             --Beratung in industrieller Datenverarbeitung
Technical Details
Message-ID: <43j992$623@gabi.gabi-soft.fr>
Path: arc1-ca.pugleaf.net!gabi-soft.fr!not-for-mail
References: <3vn1ht$kj8@martha.utk.edu> <41cke4$gtd@sparcserver.lrz-muenchen.de> <41glno$3a0@caip.rutgers.edu> <41iebe$kec@news0.rain.rg.net> <41pm80$skp@inferno.mpx.com.au> <DE02nC.B58@eskimo.com> <41t0sb$15e@news0.rain.rg.net> <DE6G2z.JJD@crdnns.crd.ge <42s5su$4h8@inforamp.net> <42u8sr$hv8@bud.shadow.net> <437fk4$5no@eco.twg.com> <439nh8$p7o@news0.rain.rg.net>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!gabi-soft.fr!not-for-mail
From: kanze@gabi-soft.fr (J. Kanze)
Newsgroups: comp.std.c,comp.lang.c
Subject: Re: Nested functions (was: Re: GOTO single exit point)
Followup-To: comp.std.c,comp.lang.c
Date: 18 Sep 1995 10:05:54 +0200
Organization: GABI Software, Sarl.
Message-ID: <43j992$623@gabi.gabi-soft.fr>
References: <3vn1ht$kj8@martha.utk.edu> <41cke4$gtd@sparcserver.lrz-muenchen.de> <41glno$3a0@caip.rutgers.edu> <41iebe$kec@news0.rain.rg.net> <41pm80$skp@inferno.mpx.com.au> <DE02nC.B58@eskimo.com> <41t0sb$15e@news0.rain.rg.net> <DE6G2z.JJD@crdnns.crd.ge <42s5su$4h8@inforamp.net> <42u8sr$hv8@bud.shadow.net> <437fk4$5no@eco.twg.com> <439nh8$p7o@news0.rain.rg.net>
NNTP-Posting-Host: gabi.gabi-soft.fr
X-Newsreader: TIN [version 1.2 PL2]