× 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:56:15 +1000
  • Importance: Normal


Hello Richard,

You wrote:
>The issue is more like "strong vs weak typing".  RPG is strongly typed.  C
>is weakly typed.  C++ is strongly typed ... is there a way to perform printf
>in C++ that is analogous to what Simon wants to do in RPG?

C **IS** a strongly typed language as anyone who tries to pass a pointer to an 
array of 
characters into a function that expects a pointer to char will discover.  Hence 
the 
plethora of C code that contains casts to void to shut the bloody compiler up!

I guess RPG is strongly typed too, just not as much as C.  When prototypes, 
dates, times, 
timestamps, and arithmetic are involved it is very particular.  It's more 
tolerant with 
MOVE since it will try to convert from one type to another sensibly.  C won't 
let you 
assign one type to another unless they are numeric and then it does the type 
conversions 
automatically.  It won't even let you assign the contents of one structure to 
another if 
they have different types.  The best you can do in C to mimic a MOVE is 
memcpy().

Both languages will let you redefine storage to make one data type appear as 
another (a 
DS in RPG, a union in C).

I agree with your comments regarding the compiler.  My problem could be solved 
by the RPG 
compiler.  (Although your discussion of string differences is very much what 
happens with 
the *STRING keyword.)

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.