× 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.



> When converting a C prototype to RPG< it seems to me that "int"
> translates to "10i 0".  True?  Not true?

True.

> What about "long int" - is that "20i 0"?

No. "long int" (or "long") is the same thing as "int".  They're both
32-bit signed binary integers.  Both map to "10I 0" in RPG.

However, "long long int" (or just "long long") is a 20I 0 in RPG.

Is it stupid that "long" and "int" are the same thing, but "long long" is
different?  Yes.  Very much so.  But, it's the way that C has evolved.  Be
glad you're an RPG programmer :)

> And where does the "u" come into play - is "10u 0" equivalent to
> "unsigned int"?

Yes.  "unsigned short" is "5U 0", "unsigned long" or "unsigned int" is
"10U 0".  "unsigned long long" is 20U 0.


> And where, pray tell, is the documentation that outlines this?

The best source is Barbara Morris' write-up, here:
http://www.opensource400.org/callc.html

Also, there's a table in Chapter 3 of the ILE C/C++ for iSeries Run-time
Library Functions (SC41-5607) manual.  Unfortunately, this table doesn't
appear to have been updated since V3R7 or so.

I should mention that I've never used either of the above resources, as
I'm fluent in both languages.  I've only looked at them because I get this
question fairly regularly. ;)

It's too bad, because the main reason that this question comes up is that
API documentation tends to describe the prototypes by showing them to you
in C.  That's really foolish, considering that C programmers are such a
gross minority on the iSeries.  But, what do I know?  IBM is infinite in
it's wisdom.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.