87937 14-JUN 14:01 Programmers Den
RE: C programming again
From: MROWEN01 To: COLORSYSTEMS
Thanks for the feedback. I tried changing the increment operator on
Monday night. This of course showed no change, nor did the number of times
the loop ran. I knew something was up. I’ll try the global declaration. I
take it you have done some significat C programming on the Coco? Should
large arrays generally be declared as global in any C programming
environment? I’m definitely looking for style tips, something books won’t
generally tell you. It’s also difficult to find any books on C under an
OS other than MS-DOS. I have a good older UNIX book that has been helpful.
What I would really like to see is some good source code for the Coco. This
would help me learn some techniques and get a flavor of the style. Where
can I find some well written C source?
-Mike
87943 14-JUN 21:19 Programmers Den
RE: C programming again (Re: Msg 87937)
From: COLORSYSTEMS To: MROWEN01
> I take it you have done some significat C programming on the Coco?
I market two game packs for the CoCo3 and OS9 Level 2. Each game pack
has 5 variations. All 10 of the game programs were written in C using
the Kreider Lib and the Tandy cgfx.l library from the Development Pack.
The compiler front end used rma and rlink also from the Dev Pack.
All use 100% “legal” OS-9 code. All graphics are done with standard cgfx.l
calls and Get/Put Buffers.
> Should large arrays generally be declared as global in any C
> programming environment?
No, you need to understand how the compiler implements that kind of stuff.
In the micro world, you tend to have to worry about memory in some way or
another. With CoCo C, you cannot write a program that either starts out
larger than 64K or dynamically grow (using the malloc() function) past
64K.
You also need to worry about how the stack is implemented. In CoCo C,
there is normally stack overflow checking, but apparently it doesn’t always
work.
> style. Where can I find some well written C source?
One place is books on C programming. Most books come with a disk of the
source files. There is also an abundance of source files here in Delphi’s
library. Some contributed by myself. Go look in the Programmer’s Den.
————————————
Zack C Sessions
They say, “Money talks”. But all mine ever says is, “Goodbye”.
87952 14-JUN 23:48 Programmers Den
RE: C programming again (Re: Msg 87937)
From: JEJONES To: MROWEN01
> I take it you have done some significat C programming on the
> Coco?
Since he’s the author of WPShell, and lots of games for the CoCo, I
Not to say “gee, didn’t
would reckon that Zack has done significant C programming on the CoCo
(and other systems, since I’ve wasted more time than I’d like to admit
playing his solitaire games on my MM/1.
you know,” just justifying my suspicions.
> Should large arrays generally be declared as global in any C
> programming environment?
Depends. If you don’t know how big the array needs to be until run
time, then you can’t declare it as global; instead, you have to declare
a pointer and allocate the space dynamically with malloc() or something
like it. Also, there’s a lot to be said for keeping data access sort of
like security, namely on a “need to know” basis. (And like security,
if too many people “need to know,” then something’s seriously wrong.)
Making stuff global that doesn’t have to be violates that principle, so
you might want to consider making such an array static.
> I’m definitely looking for style tips, something
> books won’t generally tell you.
Style is to some extent a religious issue (i.e. it induces many “holy
wars”). Thomas Plum puts out some good books with advice on C style
and conventions, but keep an eye out for examples of good style.
> What I would really like to see is some good source code for the
> Coco. This would help me learn some techniques and get a flavor of the
> style.
Shucks, you were way ahead of me already.
> Where can I find some well written C source?
IMHO, you might, ahem, want to take a look at the source to QED, recently
uploaded here on Delphi. (Ahem.
Opinions herein are solely those of their respective authors.
Clipper Chip: Big Brother Inside