|
James, Yes, C has prototypes, but you cannot use an RPG prototype in the C compiler, nor can you use a C prototype in the RPG compiler. I can definitely say that making a set of RPG prototypes that is equivalent to a set of C prototypes (.H) is a somewhat daunting task. A tool to translate a prototype definitions might be very useful, but I'm not aware of any such tools. Eric DeLong Sally Beauty Company MIS-Project Manager (BSG) 940-898-7863 or ext. 1863 -----Original Message----- From: James Rich [mailto:james@xxxxxxxxxxx] Sent: Monday, October 27, 2003 1:19 PM To: RPG programming on the AS400 / iSeries Subject: Re: Starting out with sub-procedures jt wrote: > | >> But if the procedure is written in another language, then those > | languages do not have a PI defined so there is no checking until run time. > | > | All languages have the equivalent of a PI (RPG's *ENTRY PLIST is the same > | thing with different syntax) but not all have prototyping - notably CL and > | COBOL do not. > > C has prototyping? Does the RPGLE compiler validate against the C > prototype??? Yes, C has prototyping. In fact C is one of the languages with the strongest prototyping. A prototype in C looks like: int function (char variable1, int variable2); That is the equivalent of the PR spec in RPG. And yes, the ILE compiler validates the C prototype. > > > | The real problem with this statement however is "there is no > | checking until > | run time". Leave out the words "until run time" and the statement is > | accurate. i.e. "there is no checking". The reason that prototyping is > | valuable is _because_ there is no run time checking of parms. > > That's in the C-world. CPF checks number of parms, and programs that pass > wrong data types consistently error off. They don't corrupt data, generally > speaking. C (like RPG prototypes) doesn't check prototypes at run time because they were already checked at compile time. If they didn't match, it wouldn't compile and you wouldn't be able to run it anyway. That's one reason C (and function/procedure calls) is fast. Of course, if you screw up the call stack things can get messy... James Rich "As for security, being lectured by Microsoft is like receiving wise words on the subject of compassion from Stalin." -- mormop on lwn.net _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
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.