[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference hydra::amiga_v1

Title:AMIGA NOTES
Notice:Join us in the *NEW* conference - HYDRA::AMIGA_V2
Moderator:HYDRA::MOORE
Created:Sat Apr 26 1986
Last Modified:Wed Feb 05 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:5378
Total number of notes:38326

2404.0. "C questions from a novice" by NZOV01::MCKENZIE (Support your right to arm bears) Tue Mar 28 1989 00:49

    I'd like to hear from all those programmers out there who
    have had experience with C as a language...
    
    o I am a complete novice regarding C - How easy is it to learn?
    o What are its strengths?
    o What are its weaknesses?
    o Can anyone reccommend a good compilier - if so how much? 
    
    
    Phil
T.RTitleUserPersonal
Name
DateLines
2404.1A fellow starterJGO::CHAPMANTue Mar 28 1989 03:4557
    Well, you are in the same boat as me a few weeks ago. I had only
    ever programmed in Basic and Pascal - and a long time age, Fortran.
    
    I bought Lattice C 5.0 on the basis of many good reviews and
    recommendations here. I can't add anything to the learned things
    said elsewhere in this conference about the merits viz. a viz Lattice
    versus other compilers - basically I was attracted by the source
    level debugger and bundled utilities. It is certainly a compiler
    you can grow into as a beginner - I have been learning/using it
    for about a month and probably haven't used 80% of the facilities.
    
    The documentation is good - two massive ring-bound manuals. But
    be aware that there is not a word in there by way of tutorial. There
    is a half page idiot's guide to compiling "Hello World", but after
    that you are on your own. It is certainly not light reading and
    certainly not for beginners. So you need some other books to help
    you. I bought two:
    
    From Basic to C	Can't remember who by. OK for a real first
    introduction if you are happier in BAsic. The approach is "here
    is a simple Basic program - no lets mimic it in C. It uses the Lattice
    compiler for examples. 
                           
    C by the famous Kernigan (sp) and Ritchie. Make sure you get the
    second edition, which covers the proposed ANSI standard. Not only
    is this the standard reference, it is also good to learn with (nice
    tutorials and exercises) and it is THIN. (Also expensive.)
    
    Is it easy to learn? Well the basic ideas are not so different from
    any other structured language. I'm honestly finding the syntax etc
    fairly hard going, but persevering. Expect to have to work on it.
    
    But if you want to program on an Amiga what else would you use ?
    
    PS. A note about installing Lattice 5.0 on hard discs. This kept
    me busy a half day althoughan execute file is included and it should
    be only one line of typing.
    
    Problem 1. I have only one floppy drive. Lattice comes on 5 discs,
    so the first thing to do is copy them. For some reason (I never
    did fully investigate) 'Duplicate' from the WB menu will not copy
    them. It gave some message like "This disc not copyable". The discs
    are not copy protected I hasten to add. I had to copy them from
    the CLI to my hard disc and then back to blank floppies.
    
    Problem 2. The execute file contains copy commands with the 'clone'
    keyword. I presume this is a 1.3 addition. (Is it ? What does it
    do ?)  Since I don't yet have 1.3 I had to do a global delete from 
    the execute file.
    
    Silly problems maybe, but may save other new C 'ers some time.
    
    
    for (i = now; i = evermore && practicing; ++i)
    	printf("writing c");
    
    Colin
2404.2Some recommendationsLEVERS::PLOUFFSemipro SemiologistTue Mar 28 1989 10:0925
    Two books I have found useful and widely read, although this was
    three years ago...
    
    _Learning to Program in C_, by Thomas Plum.  Assumes you already
    know something about programming.  Excellent introduction to the
    language, including a lot of good stuff on structures, arrays and
    pointers.
    
    _C Primer Plus_, published by Sams, (author The Waite Group?). 
    More basic than the Plum book, very thorough.
    
    In the editions I have seen, both these books predate the ANSI
    standard.  IMO, Kernighan and Richie is far too cryptic to learn
    anything from, but excellent as a reference.
    
    Strengths of C - compact code, abililty to do nearly anything, "native"
    language of the Amiga.  Weaknesses of C - ability to do nearly
    anything, very weak enforcement of rules.
    
    Your choices for C compilers are basically Manx Aztec C and Lattice
    C.  Their relative merits have been discussed in several previous
    notes.  You can also cobble together a completely public domain
    package (Sozobon C, A68k assembler, Blink linker, Smalllib library)
    which is missing the C "standard library."  Not recommended for
    a novice.  Cost will be $150 up -- there is no Turbo C for Amiga.
2404.3a source level debugger will help you learn fasterAITG::WISNERPaul Wisner, ...I have a totally traditional haircut...Wed Mar 29 1989 17:578
Get a source level debugger.  Especially if your accustomed to the
interactive nature of BASIC.  The MANX SDB allows you to browse through
your C data structures interactively (using standard C syntax!).  It also
lets you invoke C functions interactively.  I learned alot about C from
it (I hardly new C at all before I did SpaceKillers with MANX).

And I understand (from these notes) that the Lattice debugger is even better!  

2404.4NZOV01::MCKENZIESupport your right to arm bearsWed Mar 29 1989 18:078
    I should mention that I dont have a hard disk to install such a
    product on - someone said that Lattice comes on EIGHT DISKS????
    
    this would be impossible to work with
    
    I have an A500 with two drives/expanded to 1MB
    
    Phil
2404.5df0+df1 = 1.6megAITG::WISNERPaul Wisner, ...I have a totally traditional haircut...Wed Mar 29 1989 19:4313
I wrote my program on a 2MB system with just one floppy.  I kept everything
in a 1.6meg VD0: drive (no disk access at all!).  

On your system, it would take a little fiddling, but you could do it.  I'd 
recommend starting with a 0.5meg VD0: drive... keep include files and 
libraries in it to speed up compile times.  You could also keep source
code in VD0:.  Mine has never been trashed.  A 0.5meg VD0: should reside
entirely in FAST MEM where it's safe from the Blitter.  

Also, if you tell your C compiler to use RAM: for it's temporary files, it will
further speed things up. 

-Paul
2404.6pardon my ignorance but...NZOV01::MCKENZIESupport your right to arm bearsWed Mar 29 1989 20:571
    whats a VD0: drive?
2404.7TLE::RMEYERSRandy MeyersWed Mar 29 1989 22:4131
Re: .6

>    whats a VD0: drive?

VD0: is the ASDG recoverable ram disk.  It is like RAD: except that it
allocates and deallocates memory as the disk is filled or emptied,
and that you can not boot from it.

Re: Number of Lattice Disks

I don't think Lattice C comes on 8 disks.  I don't remember the exact
number, but I think it was 4 or 5.  The first disk was a bootable
system disk, and the last disk contains many examples and text files.  The
distribution includes two copies of the include files (compressed and
uncompressed) and two copies of the library (different memory
models).  You don't need 4 or 5 disks to do work!

Re:  Learning C

I usually recommend books by Tom Plum.  Plum does an artful job of
explaining how to be a good C programmer.  I think he does a much
better job than K&R.

Many of Plum's C books (there are several) were written before the
ANSI standard.  You may want to check his books to see if they
discuss "function prototypes" (look for either "function prototypes" or
just "prototypes" in the index).  If the book discusses prototypes,
it recent enough to be considered a guide to ANSI C for the new C
programmer.

Plum is vice chairman of the ANSI C committee.
2404.8Is C that hard to learn???GUCCI::HERBThu Mar 30 1989 18:068
    Is C compatible with all computers???
    
    I do not understand how the sound and graphic commands would work
    on the amiga.  Is there a book that would explain how to do these
    on the amiga?  What makes C harder than Amigabasic?
    
    matt
      
2404.9"Libraries" comes from old shelves of paper tapeANT::JANZENMr. MSI ECL TestThu Mar 30 1989 18:2724
    C is a modern sophisticated language.  Not as elegant as Ada, perhaps,
    but a workhorse used everywhere, and there is no Ada compiler for
    the Amiga that we could buy for under $500.  Anyway, using the sound
    and grphics and windows on the amiga is done with library calls.
    That is, the machine code for how to make a window, for example,
    is in the ROM hardware in the amiga. Some libraries are in files
    on disks.  When you want to make a window, you call that library
    routine symbolically, passing parameters for where on the screen
    the window appears and whether it has titles and can be refreshed
    after being covered by another window, etc.  This can also be done
    in BASIC, but I don't know whether all the libraries have corresponding
    BASIC pointers (memory pointers to the beginning of a library in
    ROM).  Most of the important ones do, though.  Although it can be
    tricky to learn to use libraries from BASIC, there are exmaples
    of this on the extras disk.
    C is hundreds of dollars; BASIC comes with the Amiga.  Unsophisticated
    programmers would probably need to take a guided college course
    in C in order to become good at it with good habits.  however, having
    a computer at home which one can practice for hours on, is also
    a good way to learn programming.  But starting with good habits,
    oh I forgot you're asking about C, well, just make the best judgement
    you can.  Perhaps you should see how libraries work in BASIC first.
     The principle is the same.
    Tom
2404.10How Many $'sSCUBA::WILTSHIREDave Wiltshire - CSSE EuropeThu Mar 30 1989 20:044
    How much would you expect to pay for a good 'C' compiler e.g. Lattice, 
    in the U.S. (at at place near ZKO/LKG) ?
    
    -Dave
2404.11Still waving the source level debugger flag.AITG::WISNERPaul Wisner, ...I have a totally traditional haircut...Thu Mar 30 1989 20:1424
Why is C harder than BASIC.

One reason is that it's a compiled language instead of an interpretted one. 
In BASIC you can type in a line of code, press return and get the results.

In C you have to create a working program, compile it, and run it.  Certain
mistakes will crash the Amiga.  You get a GURU message and the system reboots.
It takes alot of patience.

If you run from a source level debugger, when your program crashes, sometimes
the debugger comes up with the offending line of code highlighted on the screen.

It depends on why it crashed.  In some crashes, the debugger can't come up, or
it displays the wrong line.

These are some of the headaches C programmers deal with.  It gets better as 
you get used to the language.  A fully debugged C program is much nicer than
a BASIC program.  It runs in less memory and executes faster.  With C you
are closer to the operating system.  


Another excellent way to learn C is to compile some of the many available
PD programs and step through them with a source level debugger.  Examining
all the variables and data structures as you go.