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



Referring to the C/C++ Compiler Reference I see that the documentation
for #pragma argument says:

nowiden Specifies that the arguments are not widened before they
are
passed or received.

Although this implies that it applies only to arguments and not return
values I wonder whether that's true because there seems little point

I disagree about the implication. From the function's perspective,
arguments are received; return values are passed.

If that's true then because RPG's default behaviour is to presume no
widening then I should be able to specify no widening in the C

Are you sure we can call this "RPG's default behavior," Simon? If it were,
wouldn't the change from default require coding something like *CWIDEN,
rather than the opposite?

This supports my presumption that C always widens the return value so
I wonder what happens if I remove #pragma nowiden from the C function
and tell RPG that *CNOWIDEN is actually in effect. I make those
changes and now when I run the program I see compileFlags contains
X'75'. Curiouser and curiouser.

My assumption has always been that under the covers the binding process is
aware of the language types of the caller and called functions. Certain
"conversions" may be done in order to make the languages with different
attributes play well together.

One who is brought up in the C world rather than the RPG world might argue
that RPG is completely ridiculous in its approaches that differ from C. For
example, the length attribute rather than a null-terminated string. That's
so IBM! But it is what it is, and we have to take the things we don't like
along with those that we consider cool. On the other hand, if they all
worked alike, there'd be only one, right?

One man's treasure...

Regards,

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"A good scare is worth more to a man than good advice."
-- Ed Howe




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.