delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/07/08/16:20:02

Date: Tue, 8 Jul 2003 21:52:09 +0200 (MEST)
From: ahelm AT gmx DOT net
To: djgpp AT delorie DOT com
MIME-Version: 1.0
Subject: nested functions
X-Priority: 3 (Normal)
X-Authenticated-Sender: #0003579562 AT gmx DOT net
X-Authenticated-IP: [192.100.124.219]
Message-ID: <26365.1057693929@www22.gmx.net>
X-Mailer: WWW-Mail 1.6 (Global Message Exchange)
X-Flags: 0001

Hi,

Sorry to bother you here in the DJGPP mailing list. This might be slightly
off-topic,
but I know there are a couple of bright guys out there who might just know
this... ;-)

I try to figure out _why_ the following code compiles with DJGPP:

int abc(void)
{
  int x = 0;
  int y = 2;

  int def(int r)
  {
    int x = 1;
    return r + x;
  }

  return def(x) + def(y);
}

int main(void)
{
  return abc();
}

Could somebody enlighten me whether nested functions are a GCC or DJGPP
extension or whether they are actually part of the C standard.
A reference to the relevant chapter in the standard would be most
appreciated.
I've been digging through the standard(s), but I'm still not sure whether or
not the
above should work.

Thanks for your help,

Tony


-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++

Jetzt ein- oder umsteigen und USB-Speicheruhr als Prämie sichern!

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019