Article View: alt.msdos.programmer
Article #858Re: Newbie Wants Advice on C-Programming
From: Belgarath the Sorcerer
Date: Thu, 24 Dec 1992 03:46
Date: Thu, 24 Dec 1992 03:46
156 lines
8114 bytes
8114 bytes
In article <1992Dec23.220530.15347@netcom.com> noring@netcom.com (Jon Noring) writes:
>Hello,
>
>My wife, who is a database analyst working with DB2, etc. (all IBM mainframe
>stuff), is now interested in learning C programming because of pending changes
>at the company she works. I, too, have an interest in learning C - I'd like to
>be able to write programs to solve a variety of problems (I've done a lot of
>fairly complex scientific programming with, heaven-forbid, Fortran, so I do
>have some general programming experience).
>
>Since both of us are newbies in this area, I'd like some advice as well as
>answers to the following questions:
>
>1) There seems to exist C, as well as C++, and possibly other variants. What
> are the differences between these? Which should we learn first?
>
>2) We want to do most of our programming on our 386-33 PC running MSDOS 5.0.
> What C-type compilers exist for the PC? Which ones are better? How much
> do they cost and where can one get them at a discount?
>
>3) How robust is C compared to Fortran for purely number crunching, scientific
> type applications on the PC?
>
>4) What books would you recommend in learning C (my wife might want to take
> classes - I do better teaching myself)? And of course, since I will be
> doing programming on a PC, what books would you recommend that are
> specific to that platform, especially w.r.t. memory management as well
> as graphics?
>
>
>Much thanks for your help/advice.
>
>Jon Noring
>
>=============================================================================
>| Jon Noring | noring@netcom.com | I VOTED FOR PEROT IN '92 |
Welcome to the 20th century of computing! :-) I suspect I know
which company your wife works for, but I won't go into that. :-)
Your questions may qualify as FAQ - I dunno. But I'll be happy
to give some answers.
1) Grammatically speaking, C++ is an extension of C. A C++ compiler
will happily compile regular old C source code; naturally, doing
so wastes all the extra power in C++
C++ is an OOP language; that is, it was designed for Object
Oriented Programming. All of its extensions are designed to
let you do OOP.
C, on the other hand, is a traditional, top-down programming
language. It was designed for portability and the maximum
in extensibility. You can judge for yourself how well it
achieves those goals.
Which should you learn first? Well, if you want to make the
leap into OOP, start with C++.
HOWEVER, I suspect that simply making the jump to C will be
difficult enuf. You may not want to try to leap into OOP
at the same time. OOP and traditional programming are two
totally different mindsets. Unless you are schizo, its
extremely difficult to switch back and forth. If you're
not interested in getting into OOP, then I'd go with C.
2) Your platform sounds good. On the PC, the major players in
the C compiler market are Borland, Microsoft, and Zortech.
There ARE others...these are just the ones that are
usually regarded as 'major'. Whatever that means.
I'm not going to come right out and say 'X compiler is better
than Y compiler'...I'm not here to start a flamewar.
Borland compilers tend to compile and link faster than
the Microsoft ones. Microsofts optimizations tend to be
better. Borland's floating point emulation code runs faster
than Microsoft's, but Microsoft tends to be faster in the
integer arithmetic arena. I have never used any Zortech
compilers, but once bought some C-code libraries from
them and was EXTREMELY dissatisfied.
You will prolly pay on the order of several hundred dollars
for a C compiler. I would look in Computer Shopper to get
the best prices. I don't have one handy. Last time I looked
at Microsoft C was Version 6.01a (it is up to Version 7
now) and it was about $350 then.
3) Unlike FORTRAN (and Pascal and some other languages), C have
(excuse me, has) very little in the way of built-in
number-crunching functions. Some compilers include math
libraries that do a decent job...but these are extensions,
not part of the C language itself, so the functions and
their usages vary from compiler to compiler.
You see (no pun intended), in order to give C the maximum in
flexability, its designers (Kernigan and Ritchie) only put
a minimum of I/O and math functions in the language. To
do things like complex math and string ops and so forth you
get libraries of routines. If the numeric-processing library
that comes with your compiler doesn't pack the oompf you
need, all you have to do is go get another, more powerful
one and link it in and you can use it instead.
This contrasts with languages like FORTRAN, where all this
stuff is built-in. And if your particular implementation
of FORTRAN has any shortcomings, too bad. You can't switch
parts out. C lets you select the library of routines that
best fits your needs.
Also, C is MUCH more memory efficient than FORTRAN. But then
FORTRAN is an old has-been. ANSI blew FORTRAN's chance to
be a real language when the dropped pointers from its
revision (altho some compiler-makers have wisely decided
to ignore ANSI in this case and added pointers anyway).
4) Hmmm. Part of this depends on what compiler you choose. I have
done 80% of my work in C using Microsoft C (first Version 5.1,
later 6.0). I found "The Waite Group's Microsoft C Bible"
(2nd Ed.) to be a very good reference. ISBN 0-672-22736-3.
They also put out another good book, called "MS-DOS Developer's
Guide" which had lotsa stuff on memory management and graphics.
ISBN 0-672-22630-8. As for learning how to program in C,
a book titled "Variations in C" (2nd Ed.) seemed to be pretty
decent. ISBN 1-55615-285-X. Two other books you might find
useful are "DOS Programmer's Reference", ISBN 0-88022-458-4
and "The Programmer's PC Sourcebook" (2nd Ed),
ISBN 1-55615-321-X.
A course at a local college or university is prolly a good place
to start off learning C. Make sure the course on C is a regular
part of their curriculum and not just taught occasionally by some
guy who usually teaches BASIC.
Depending on how fast you pick things up, you can expect to
spend 6 months to a year programmin C (or C++, for that matter)
before you reach any real level of proficiency. I look back at the
code I wrote during the first 6 months I spent writing C and I
shudder in revulsion.
If you have been a mainframe-type for many years, do not expect to
pick C up in a week. Pointers are likely to be a major stumbling
block - I doubt DB2 has anything like them. C is going to be a whole
new way of thinking - it is a language that assumes you know what you
are doing and gives you plenty of rope to do whatever you want,
including hanging yourself.
Good luck.
Belgarath the Sorcerer
bank@lea.csc.ncsu.edu
DISCLAIMER: The above message constitutes an honest effort by the
author to impart information he knows, or reasonably
knows, to be true. All other interpretations are in
error.
Technical Details
Message-ID:
<1992Dec24.034656.17119@ncsu.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!taco!lea.csc.ncsu.edu!bankReferences:
<1992Dec23.220530.15347@netcom.com>Show Full Headers
Complete Article Headers
Newsgroups: alt.msdos.programmer,comp.os.msdos.programmer,comp.sys.ibm.pc.programmer,comp.lang.c++,comp.lang.c Path: arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!taco!lea.csc.ncsu.edu!bank From: bank@lea.csc.ncsu.edu (Belgarath the Sorcerer) Subject: Re: Newbie Wants Advice on C-Programming Message-ID: <1992Dec24.034656.17119@ncsu.edu> Sender: news@ncsu.edu (USENET News System) Organization: /etc/organization References: <1992Dec23.220530.15347@netcom.com> Date: Thu, 24 Dec 1992 03:46:56 GMT Lines: 158