× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: Prototyping printf()
  • From: "Simon Coulter" <shc@xxxxxxxxxxxxxxxxx>
  • Date: Tue, 26 Sep 00 11:55:15 +1000


Hello Scott,

You wrote:
>This was true once upon a time, RPG III was strongly typed.  I don't think
>RPG IV is any more strongly typed than C, however.   

Curious.  I'd think RPG IV is no more weakly typed than RPG III.

>Pointers in C can be declared as pointers to char, int, struct, etc.  RPG 
>does not allow this, which means that the C compiler can find more
>mismatches than the RPG compiler can.   

That's what (void*) is for :)

--- stuff deleted ----

>The problem as I see it, is that RPG's prototypes have nothing that works
>the same was as the elipses (...) in C.   (Well, I guess "CALLB" is 
>close, but is ugly, and not as powerful as prototyped calls.)

Exactly.  But I don't think CALLB would work here because printf() expects 
VALUES not 
addresses.

>Of course, this whole thread has left me wondering "why on earth does he
>need to use printf in RPG?" :)

I don't.  I just have this tendency to DO THINGS PROPERLY.  Whenever I need to 
use a C 
function I find the include that contains it and I convert it to RPG IV -- ALL 
OF IT -- 
THE WHOLE BLOODY INCLUDE!  (Or at least as much of it as makes sense so the 
result is RPG 
equivalents for the constants, function calls, structures, etc.). Eventually 
I'll work my 
way through the entire C library and Unix APIs.

I was playing with the series of isxxxxx (isspace, isprint, etc.) functions and 
wanted to 
test them by printing a table of the different attributes for each character -- 
hence the 
choice of printf() -- I couldn't be bothered to define a printer file (or shock 
horror 
O-specs).  Since I was printing either a string or an integer I simply defined 
two 
prototypes to generate the table but that started me on the experiment.  Could 
I 
acomplish the magic with one prototype?  Nope, nada, nyet, 

Regards,
Simon Coulter.


 FlyByNight Software         AS/400 Technical Specialists       
 Eclipse the competition - run your business on an IBM AS/400.  
                                                                
 Phone: +61 3 9419 0175      Mobile: +61 0411 091 400           
 Fax:   +61 3 9419 0175      mailto: shc@flybynight.com.au      
                                                                
 Windoze should not be open at Warp speed.                      

+---
| 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 thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.