www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/14/04:48:02

From: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
Organization: Materials Science Centre
To: DJGPP AT DELORIE DOT COM
Date: Fri, 14 Feb 1997 09:27:56 GMT
Subject: function in function
Message-ID: <23E917870F3@fs2.mt.umist.ac.uk>

  [Please reply to me in person also]

  Line 621 etseq of file DJGPP\INFO\GCC.I8 says that in djgpp C functions can
be declared inside functions, and quotes this example:-
       foo (double a, double b) {
           double square (double z) { return z * z; }
           return square (a) + square (b); }
  But I wrote this short C++ program:-
        main(){int i;
            int aux(int j){j=8;};
        i=8;}
  and djgpp v2 refused it, thus:-
C:\AMZIP>gcc _.cc
_.cc: In function `int main()':
_.cc:2: parse error before `{'
_.cc: At top level:
_.cc:3: warning: ANSI C++ forbids declaration `i' with no type or storage class
_.cc:3: parse error before `}'
C:\AMZIP>

- Raw text -


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