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




On 02/10/2004, at 12:48 PM, Hall, Philip wrote:

Perhaps he aimed it towards the Jabberwocky reference.

Maybe so, its a neat poem. The Alice books and Pooh Bear books are among my favourites--even now.


Or maybe to the fact that the code he quoted was stuffing (what could be potentially) a large amount of data into argv[1] with no regard to the size of the allocated memory being used by argv[1].

True, I did state that parameters in the caller and callee must be compatible. That's no different from parameter mismatches in any programming language. For example:


PGMA:
D parm1       S       10
C              CALL     PGMB( parm1 )

PGMB:
D pgmb       PI
D parm1              100
C            EVAL    parm1 = *ALL'X'

Oops, just trashed caller's storage.

The caller could provide the available length in another argument. The callee could use strlen(argv[1]) to derive a possible maximum length, presuming the caller blank-filled and null-terminated the input string, or could use the CEEDOD API to determine the data type and length.

Or maybe to the suggestion that the same method could be used for returning packed decimal data too.

It can be, although I prefer the casting alternative.

I guess I'm curious as to why an OS/400 C programmer would think doing these things is strange. I can certainly understand why C weenies from other platforms would think this strange but OS/400 programmers should be familiar with pass-by-reference dynamic program calls.

Regards,
Simon Coulter.
--------------------------------------------------------------------
   FlyByNight Software         AS/400 Technical Specialists

   http://www.flybynight.com.au/
   Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
   Fax:   +61 3 9419 0175                                   \ /
                                                             X
                 ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------



As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.