POV-Ray : Newsgroups : povray.unofficial.patches : Major bug in MegaPOV Plus? : Re: Major bug in MegaPOV Plus? Server Time
2 Sep 2024 06:13:35 EDT (-0400)
  Re: Major bug in MegaPOV Plus?  
From: Peter J  Holzer
Date: 14 Sep 2000 18:01:59
Message: <slrn8s2flt.9al.hjp-usenet@teal.h.hjp.at>
On 12 Sep 2000 05:17:32 -0400, Warp wrote:

>: (except that I'm surprised that this works inside another
>: function
>
>  The C standard says that a function definition can be done inside another
>function. If done so, the scope of that function definition is only inside
>that other function

No, only function *declarations* inside other functions are permitted,
but not function *definitions*.

Thus:

    int main(void) {
	extern void foo(void);

	void();
	return 0;
    }

is allowed, but:


    int main(void) {
	void foo(void) {
	    printf("hello\n");
	}

	void();
	return 0;
    }

is not.

>(it has a clear modular reason).

There is a good technical reason why it is not allowed. It makes
function pointers very difficult to implement and unintuitive to use. 

Nevertheless, gcc implements it as an extension.

	hp

-- 
   _  | Peter J. Holzer    | Nicht an Tueren mangelt es,
|_|_) | Sysadmin WSR       | sondern an der Einrichtung (aka Content).
| |   | hjp### [at] wsracat      |    -- Ale### [at] univieacat
__/   | http://www.hjp.at/ |       zum Thema Portale in at.linux


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.