home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky alt.msdos.programmer:3005 comp.os.msdos.programmer:11608 comp.sys.ibm.pc.programmer:670 comp.lang.c++:18392 comp.lang.c:18867
- Newsgroups: alt.msdos.programmer,comp.os.msdos.programmer,comp.sys.ibm.pc.programmer,comp.lang.c++,comp.lang.c
- Path: sparky!uunet!grebyn!daily!malak
- From: malak@grebyn.com (Michael Malak)
- Subject: Re: Newbie Wants Advice on C-Programming
- Message-ID: <1992Dec24.172333.7339@grebyn.com>
- Organization: Grebyn Timesharing
- References: <1992Dec23.220530.15347@netcom.com>
- Date: Thu, 24 Dec 1992 17:23:33 GMT
- Lines: 164
-
- In article <1992Dec23.220530.15347@netcom.com> noring@netcom.com (Jon Noring) writes:
- >Hello,
- >
- >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?
-
- In my opinion, there is no fast track to either C or C++. I feel the
- following must be learned in order:
- 1) Pascal, with two semesters experience
- 2) Assembly, learned anywhere, with tinkering on your own
- 3) C, 2-3 years min. anywhere (college, real world, or tinkering)
- After that you can learn and appreciate C++. You need to first learn
- structured programming and algorithms, most importantly, linked lists
- and trees. Since C is tightly coupled to assembly in many ways (C is a
- shorthand for assembly, and C integrates easily with assembly modules),
- you need to known assembly to understand what is going on in your C
- program. The after you know C, it takes _years_ of experience to really
- know it. After 6.5 years, I'm still learning. After 5 years, I was
- doing object-oriented programming in C (not C++) without really
- realizing it. It was at that point that I could appreciate the
- syntactic shorthand of C++ for object-oriented programming. I've never
- programmed in C++, BTW, due to the lack of a really good mainstream
- 32-bit C++ compiler for MS-DOS.
-
- To summarize, C programs should appear structured like Pascal programs,
- but are really shorthand for assembly programs. C++ facilitates
- object-oriented programming, but you need experience when to use it
- because you can too easily introduce inefficiencies.
-
- >
- >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?
-
- The first question is 16-bit or 32-bit. 16-bit compilers generate
- native MS-DOS programs and MS Windows 3.x programs. 32-bit compilers
- generate DOS-extended programs (which appear to run just like native
- MS-DOS programs) and, in the case of Microsoft's C compiler, Windows NT
- programs.
-
- The best 16-bit compiler ever made is unfortunately no longer available.
- It was Microsoft C 6.0. I should qualify "best"; I mean in terms of
- professional MS-DOS development. Although I have little experience with
- Borland C compilers, I would have to recommend it to you for the
- following reasons (if you want a 16-bit compiler):
-
- 1) Beginners tend to love Borland's "integrated development environment",
- where I presume you can edit, compile, link, and debug from what
- appears to be the same program.
-
- 2) Microsoft C++ 7.0 requires the finicky 386-MAX memory manager for
- compiling and linking under DOS, thus making it unattractive for
- creating DOS programs.
-
- 3) Borland has aggressively added support for creating Windows programs,
- so much so that it is unclear which is better for Windows development
- (typically programmers will stick with the "official" C compiler no
- matter how bad it is, because of compatibility and compiler bug
- issues).
-
- For 32-bit development, the Intel C Code Builder is in my opinion the
- best for creating DOS programs since it can link in MASM 6.0 modules.
- MASM 6.0 is the best assembler I have ever seen for any computer. It
- allows you to create very structured and readable assembly code, and
- seamlessly shares data and functions with C. Note, however, that it is
- just a C compiler, not a C++ compiler. As I said above, there are no
- really good mainstream 32-bit C++ compilers. I don't feel Zortech C++
- qualifies because it doesn't come with a 32-bit C++ debugger, I keep
- hearing bad things about it, and it uses a 286 DOS extender with a 16MB
- memory barrier. The memory barrier on a 386 DOS extender, such as the
- one built-in the the Intel Code Builder, is 4GB.
-
- For 32-bit Windows development, the only choice as far as I know for
- Windows NT is the special version of Microsoft C++ 7.0 that comes with
- Windows NT beta developer's kit. There are 32-bit C compilers for
- Windows 3.x, but I wouldn't recommend them since they are not
- mainstream.
-
- To me, "mainstream" is important because it means a higher quality
- product and better support. It means more complete and more
- professionally done documentation. It means more complete and wider
- beta testing. It means larger resources to fix the bugs that you find
- and report in their compiler.
-
- In any case, you should get MASM 6.0, which lists for $150. It is both
- a 16-bit and a 32-bit assembler and can link with Microsoft, Borland,
- and Intel C compilers.
-
- The Intel C Code Builder lists for $595. I'm not sure of the prices for
- Microsoft C++ and Borland C++, but I imagine they are $300 - $500.
-
- >
- >3) How robust is C compared to Fortran for purely number crunching, scientific
- > type applications on the PC?
-
- C does not do range-checking on array indices. This is one way that C
- is coupled to assembly: a[i] means _exactly_ "add a to i and
- dereference". In fact a[i] and i[a] are synonyms! If you want to incur
- the overhead of range-checking, you could easily do so in C++.
-
- One reason that FORTRAN is associated with good number crunching
- capabilities is that there exist out there optimized, proven math
- libraries. I would guess that that is not so much of an issue anymore,
- that math libraries are available and/or have been ported to C, but I've
- never done scientific number crunching in FORTRAN, so I don't know what
- I'm missing.
-
- >
- >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?
-
- You should always start out with the official books:
-
- For C, it is _The_C_Programming_Langauge_ 2nd ed. by Kernighan & Ritchie
- For C++, it is _The_C++_Programming_Language 2nd ed. by Stroustrup
- For assembly, it is the programmer's reference manual publsihed by the
- chip's manufacturer. I would recommend the i486 programmer's
- reference manual published by Intel. The invaluable quick reference
- guide that comes with MASM 6.0 tells you which instructions are
- available on which processor(8088, 286, 386, and 486).
-
- For each language, you may optionally buy a more tutorial or descriptive
- book. The books listed above are more reference books than tutorials.
- Although they do start with the basis, and then build on them, they do
- so in a math book kind of way. Just go to a computer book store and
- thumb through some of the books and buy the one(s) that appear to teach
- the way you like to learn. Use the reference books to verify the
- tutorial books, and to provide complete information.
-
- As for memory management, it is a non-issue in the 32-bit world, which
- is the way the world is going. The kluges invented for the 16-bit
- DOS world, expanded memory (EMS) and extended memory (XMS) are pretty
- technical and not necessary for either 16-bit Windows or 32-bit DOS
- extenders.
-
- As for graphics, you'll need to use Windows calls to do graphics under
- Windows. I've never done any programming under MS Windows (I wrote my
- own windowing system since MS Windows was too slow for the real-time
- displays required by my current project), so I don't know any books to
- recommend. To do graphics under DOS, you _might_ find the library calls
- that come with the C compiler sufficient. Most people just write
- directly to the VGA registers. The standard, but _poorly_ written,
- guide is called something like _Programming_EGA/VGA_, 2nd edition by
- Ferarro.
-
- >
- >
- >Much thanks for your help/advice.
- >
- >Jon Noring
- >
- >
- >(p.s., I looked for a FAQ about my questions, but did not happen to find one,
- >so please no flames in the event there is a FAQ for this.)
- >
- >--
- >
- >Charter Member of the INFJ Club.
-
- - Michael Malak, INTP
-
-