On 14/06/2008, at 12:00 AM, Jevgeni Astanovski wrote:

C is very user friendly. Simply keep it simple.

Very few people would agree with C being friendly. It has too many areas that bite unexpectedly even when keeping things simple. Classic example is: if ( a = b )


Why cannot you write:

decimal(15,0) logECD_STP3(char *moduleName, char *locationID, char *logMessage, const int *byteRcv, const char *dataRcv)

which is exactly the same as yours, but without all these typedefs.
Doesn't it look more simple and readable?

It does from a C programmer's perspective. The problem is that char* implies a null-terminated string and Lim really wants to pass fixed- length character variables.

By using typedefs he forces the C programmer to at least be aware that passing "XYZ" into a CHAR(10) will cause problems. What is expected is at least "XYZ " with blank padding.


I know nothing about RPG, but from what I read there in your letter, it seems, that byteRcv must not be passed as pointer but rather as value....

No, passing a variable by reference is the same as passing a pointer by value. C makes you think about pointers. RPG handles the mess under the covers so you can simply think about data. In both case the address of the data is being passed and received.


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

http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
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-2021 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.