[comp.sys.cbm] Power-C

rickc@pogo.GPID.TEK.COM (Rick Clements) (09/27/88)

--------

I have just started using Power-C.  I tried porting a program I got from
the net (calform.c).  I had it running on my PC.  With a little fiddling
I now have it running on my C128.  Howerver, I have a couple of questions;
I would like to do things better next time.

1) The program works if I DON'T run it though trim.  If I run it though trim
   it can't find the leading "-" on the command line arguments.  Has anyone
   else had trouble with trim?  (-: I can make the code much smaller if I
   don't expect it to work. :-)

2) Are there any options to give me a link map?  If I chase down the problem
   with trim, I would like to compare at the machine code level.

3) When I typed "cc" (no arguments), I got a list of options.  Most of the
   arguments aren't listed in the manual.  Does anyone know what the do.

4) The compiler wouldn't initialize an array of struct containing an int and
   pointer to char.  (I added all the "optional" curly brackets; it didn't
   help.)  It initialized array's of pointer to char with no problem.  I
   initialized the struct at run time.  Is there a way to get it to initialize
   the struct at compile time?  Or, does this need to worked around?

5) I tried to create a stderr.  I created a global variable and opened the
   screen with open() (not fopen()).  It worked fine ... until I redirected
   stdin on the command line.  Has anyone else seen anything like this?
   (I have not had a chance to play with this yet, but I thought I might
   as well add this to my list of questions.)

It is so much "fun" learning the idiosyncraies of a new system.  Thanks
for any help you can give me in getting started.
-- 
Rick Clements (RickC@pogo.GPID.TEK.COM)

prindle@NADC.ARPA (Frank Prindle) (10/04/88)

Rick Clements noted that, based on the Power-C documentation, streams should
be declared "FILE stream;" which is seemingly inconsistent with the K&R
standard library declaration of "FILE *stream" (i.e. a FILE is a pointer).
But declaring "FILE *stream" in Power-C will work just as well; nobody says
that a FILE pointer must be an address, it just must somehow unambiguously
describe the file. In Power-C, fopen will return small positive values (like
12) which may be construed as pointers. Thus there is no reason, when porting
over a K&R standard program, to change all the declarations from FILE 1571.Z ada-repository.info bphollander bridger cpower.Z dhry.c.Z dhry.c2.Z dhrystone disk.formats.Z fhak.q font.Z font2.Z lui macro-elim.Z midi.Z newcbm priority_inversion.paper