|
function predefinition
#68325
03/26/06 18:08
03/26/06 18:08
|
Joined: Jan 2003
Posts: 4,305
Damocles
OP
Expert
|
OP
Expert
Joined: Jan 2003
Posts: 4,305
|
Actually, there is the requirement to define function dummies, if a function is called in the script, if the function itself is defined "lower" in the script. Otherwise the function is not found. (sometimes the compiler finds it, even if it is defined "lower", very strange)
How about that the compiler first checks the script for all actions and function and variables, that are placed, and then starts the real compilation, this leaves the need for predefinition out, And would speed up the implementation of new function a bit,
or is there some restriction to this mehtod?
|
|
|
Re: function predefinition
[Re: Damocles]
#68326
03/26/06 18:11
03/26/06 18:11
|
Joined: Mar 2003
Posts: 569
FRAJO
User
|
User
Joined: Mar 2003
Posts: 569
|
function dummy_func;
function dummy_func() { .... }
-------------------------------------------
ICQ: 242543712
Ich bin nicht hier und bin nicht da.
Wo bin ich dann?
".."
("")
^ ^
This is the evil vampire bunny. Copy and paste him into your signiture to help him achieve world domination. Yeah
|
|
|
Re: function predefinition
[Re: Damocles]
#68328
03/26/06 19:24
03/26/06 19:24
|
Joined: Jul 2004
Posts: 1,205 Greece
LarryLaffer
Serious User
|
Serious User
Joined: Jul 2004
Posts: 1,205
Greece
|
Quote:
Otherwise the function is not found. (sometimes the compiler finds it, even if it is defined "lower", very strange)
it will only find it if the function has none or one parameter. more than one parameters require the function to be predefined
I doubt they're gonna make any such improvements to c-script. Hopefully, lite_c will be more flexible in that matter
|
|
|
Re: function predefinition
[Re: jcl]
#68330
03/27/06 13:25
03/27/06 13:25
|
Joined: Oct 2003
Posts: 4,131
Matt_Aufderheide
Expert
|
Expert
Joined: Oct 2003
Posts: 4,131
|
LOL! Funny Pretty much all structured programming languages and compilers need to have the functions, variables, classes, etc all defined before they are called. This is the basis of the structured approach, dating way back. I dont think Conitec is going to try to change this.
|
|
|
Re: function predefinition
[Re: Damocles]
#68332
03/28/06 19:37
03/28/06 19:37
|
Joined: Jul 2000
Posts: 8,973 Bay Area
Doug
Senior Expert
|
Senior Expert
Joined: Jul 2000
Posts: 8,973
Bay Area
|
Quote:
I guess the reason for the predefinition is just to have it more simple to program the compiler.
Yes, but some people also find it useful for avoiding bugs (however, with today's compilers it probably isn't needed).
The main reason we'll probably stick with it is because it's done this way in C so it should be done this way in Lite-C.
|
|
|
|