I have coded my first C program. I put it here.
http://wiki.midrange.com/index.php/C_version_of_DISPR
It is a conversion on an RPGLE program I posted here (slightly different)
http://wiki.midrange.com/index.php/UDDS_File_Displayer#DISPR_RPG
The resultant C code is a mass of function calls developed by others,
thank GOD, so I dont think what I did is 'close to the metal' at all.
IMO the function calls make the resultant C code as abstract as RPG but
still with the added myriad C pitfalls still waiting to get you.
Also I found the C version needed more code than RPG and I can now
relate to the comment that RPGLE is a wannbe C, I pray that RPGLE
never becomes a C but that it evolves on its own part , as it has,
with the power of C but none of the convolutedness.
I believe the problem with C is that every function and statement can
return a single value and can be treated as a variable which then
enables coders to go on a involuted embedding spree that is impossible
to untangle.
I found that Notepad++ (with C addon) is really useful to get the {} aligned.
When coding C I found it best to code a simple minimal shell that compiles.
Then add a few lines and compile that and so on.
It means an order of magnitude increase in compiles vs RPG.
It means I know which lines are in error. I cant remember who told me of
this technique, but many thanks.
I found the C fancy coding constructs IMO dont achieve much, apart from
looking pretty and confusing the heck out of non C coders.
If anyone can find a few moments I would like some feedback please on
what I could have done better. Riducule is welcome.
My next goal is to learn C++ and classes with the objective of
setting up a Class to process subfiles, or is this a really lame object.
Thanks.
Frank Kolmann
As an Amazon Associate we earn from qualifying purchases.