|
Okay, now it makes sense. It is the same way languages such as Pascal do it. The prototype at the top just tells the compiler - Hey compiler, I have this procedure in my program, set aside some memory for it's location. That way when the compiler runs across a call to the procedure before it sees the actual procedure code it knows what to do, it points the call to the memory location it had set aside to it, something like a pointer. In Pascal Prototyping was not required, but I found that I would start juggling around my subroutines and functions every time I modified them to make sure that the functions that called other functions were found in the code first. A big pain, then I started prototyping all of them. Regards, Jim Langston Scott Klement wrote: > Jim Langston <jlangston@conexfreight.com> wrote: > > > > The Prototype is only needed for the compiler, if you had many > > callable subroutines in your source code, you would put all the > > Prototypes at the top, but but each program interface by each > > subroutine? Wait, that doesn't make since, since all D specs have > > to be declared at the opt of code anyway! > > > > Actually, you have seperate D-specs for every procedure. > > The procedure interface should always be declared (IMHO) in the first > D-specs of your procedure definition. > > Furthermore, if your procedure depends on another procedure thats not > in the same module, the prototype for THAT procedure should be > /COPY-ed into the D-specs for the procedure that needs it. The > variables that are needed within a procedure should also be defined > as local to that procedure... > > This way, you can easily copy that procedure, make small changes, and > have a working routine... The code is reusable! Global definitions > ruin this. Plus, the fewer inputs and outputs to the procedure make > it easier to debug and maintain... (again, thats IMHO) > > Very powerful concepts, here, but they take a little bit of working > with to get used to :) > > +--- > | This is the RPG/400 Mailing List! > | To submit a new message, send your mail to RPG400-L@midrange.com. > | To subscribe to this list send email to RPG400-L-SUB@midrange.com. > | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. > | Questions should be directed to the list owner/operator: david@midrange.com > +--- +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.