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



Frank - sorry I should have mentioned this before.

There is one book available that introduces C from an RPG perspective. "C for RPG Programmers" by Jennifer Hamilton. Originally published by Duke (i.e. Penton) - I don't know who issues it now but this will give you ISBN etc. http://www.amazon.com/C-Rpg-Programmers-Jennifer-Hamilton/dp/0962874361

It is written with the original C compiler in mind (i.e. pre-ILE) but the bulk of the information is still valid.

On 2014-01-21, at 5:17 AM, frank kolmann <fkolmann@xxxxxxxxx> wrote:

Hi Jevgeni


Comments inline.

Regards
Frank Kolmann


date: Mon, 20 Jan 2014 11:50:35 +0000
from: Jevgeni Astanovski <Jevgeni.Astanovski@xxxxxxxxxxxxx>
subject: Re: [C400-L] C syntax errors

Frank,
I learnt programming C more than 20 years ago - and I used solely K&R book.
Just start from the beginning and do all exercises without exceptions
- this is how I did it.
Of course there is one little thing to mention -
you also occasionally need someone who is ready to act as a tutor.

Looks like the K&R book is the way to go. No one has mentioned any other.
Have you still got your solution for exercise 5.20.
If so can I have the code please?

This is for 2 major issues:
1. You must get familiar with the particular programming
environment/compiler.
This is not covered in the Book so you will need external help.
2. You will need that "someone" to prevent you from spending
hours on stupid problems, like, for example one { missing in the source
example.

I am using the iSeries C compiler, so far so good.
I dont have a tutor, so my problems are my own.


Now in general.
As far as I understand, there is such a thing like "C-style".
Some people are proud that they are writing C using "C-style".
This "while (ns-->0) is very C-style. Your example with double * is also
C-style.
C-style assumes using lots of *, &, -> and mixing them in all possible
combination making it close to impossible for anyone
(including yourself after a month) to understand the code.
But you can also write clearly understandable code - and not take
care of minimizing keystrokes, which indeed is a very bad practice.

I certainly intend to not use "C-style" but its a two edged sword
what to dont use you lose.

Another thing - there is no such thing like: you MUST write short
functions.
One simple reason - it is always easier to read consecutive row of
source code lines than to jump from one function to another,
then from there further (deeper) and again and again.
So my advise - write the way YOU like, the way YOU feel convenient with.
And luckily for us - C allows you to do it.

I know the problem of function upon function upon function etc. I
have seen this is RPG ILE and I am wary of it.

And one last thing - from an old-style programmer.
Do not start to write code before you have a more or less
(at least high-level) understanding of what you are writing.

I am up to Ch 5 in K&R and I think I have a good understanding so far.
From another old programmer I understand what you mean.
I am learning C because I got bored.


Good luck!
Thanks

Jevgeni.
--
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list
To post a message email: C400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com





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.