home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / alt / msdos / programm / 3005 < prev    next >
Encoding:
Internet Message Format  |  1992-12-24  |  8.2 KB

  1. 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
  2. Newsgroups: alt.msdos.programmer,comp.os.msdos.programmer,comp.sys.ibm.pc.programmer,comp.lang.c++,comp.lang.c
  3. Path: sparky!uunet!grebyn!daily!malak
  4. From: malak@grebyn.com (Michael Malak)
  5. Subject: Re: Newbie Wants Advice on C-Programming
  6. Message-ID: <1992Dec24.172333.7339@grebyn.com>
  7. Organization: Grebyn Timesharing
  8. References: <1992Dec23.220530.15347@netcom.com>
  9. Date: Thu, 24 Dec 1992 17:23:33 GMT
  10. Lines: 164
  11.  
  12. In article <1992Dec23.220530.15347@netcom.com> noring@netcom.com (Jon Noring) writes:
  13. >Hello,
  14. >
  15. >1) There seems to exist C, as well as C++, and possibly other variants.  What
  16. >   are the differences between these?  Which should we learn first?
  17.  
  18. In my opinion, there is no fast track to either C or C++.  I feel the
  19. following must be learned in order:
  20.    1) Pascal, with two semesters experience
  21.    2) Assembly, learned anywhere, with tinkering on your own
  22.    3) C, 2-3 years min. anywhere (college, real world, or tinkering)
  23. After that you can learn and appreciate C++.  You need to first learn
  24. structured programming and algorithms, most importantly, linked lists
  25. and trees.  Since C is tightly coupled to assembly in many ways (C is a
  26. shorthand for assembly, and C integrates easily with assembly modules),
  27. you need to known assembly to understand what is going on in your C
  28. program.  The after you know C, it takes _years_ of experience to really
  29. know it.  After 6.5 years, I'm still learning.  After 5 years, I was
  30. doing object-oriented programming in C (not C++) without really
  31. realizing it.  It was at that point that I could appreciate the
  32. syntactic shorthand of C++ for object-oriented programming.  I've never
  33. programmed in C++, BTW, due to the lack of a really good mainstream
  34. 32-bit C++ compiler for MS-DOS.
  35.  
  36. To summarize, C programs should appear structured like Pascal programs,
  37. but are really shorthand for assembly programs.  C++ facilitates
  38. object-oriented programming, but you need experience when to use it
  39. because you can too easily introduce inefficiencies.
  40.  
  41. >
  42. >2) We want to do most of our programming on our 386-33 PC running MSDOS 5.0.
  43. >   What C-type compilers exist for the PC?  Which ones are better?  How much
  44. >   do they cost and where can one get them at a discount?
  45.  
  46. The first question is 16-bit or 32-bit.  16-bit compilers generate
  47. native MS-DOS programs and MS Windows 3.x programs.  32-bit compilers
  48. generate DOS-extended programs (which appear to run just like native
  49. MS-DOS programs) and, in the case of Microsoft's C compiler, Windows NT
  50. programs.
  51.  
  52. The best 16-bit compiler ever made is unfortunately no longer available.
  53. It was Microsoft C 6.0.  I should qualify "best"; I mean in terms of
  54. professional MS-DOS development.  Although I have little experience with
  55. Borland C compilers, I would have to recommend it to you for the
  56. following reasons (if you want a 16-bit compiler):
  57.  
  58. 1) Beginners tend to love Borland's "integrated development environment",
  59.    where I presume you can edit, compile, link, and debug from what
  60.    appears to be the same program.
  61.  
  62. 2) Microsoft C++ 7.0 requires the finicky 386-MAX memory manager for
  63.    compiling and linking under DOS, thus making it unattractive for
  64.    creating DOS programs.
  65.  
  66. 3) Borland has aggressively added support for creating Windows programs,
  67.    so much so that it is unclear which is better for Windows development
  68.    (typically programmers will stick with the "official" C compiler no
  69.    matter how bad it is, because of compatibility and compiler bug
  70.    issues).
  71.  
  72. For 32-bit development, the Intel C Code Builder is in my opinion the
  73. best for creating DOS programs since it can link in MASM 6.0 modules.
  74. MASM 6.0 is the best assembler I have ever seen for any computer.  It
  75. allows you to create very structured and readable assembly code, and
  76. seamlessly shares data and functions with C.  Note, however, that it is
  77. just a C compiler, not a C++ compiler.  As I said above, there are no
  78. really good mainstream 32-bit C++ compilers.  I don't feel Zortech C++
  79. qualifies because it doesn't come with a 32-bit C++ debugger, I keep
  80. hearing bad things about it, and it uses a 286 DOS extender with a 16MB
  81. memory barrier.  The memory barrier on a 386 DOS extender, such as the
  82. one built-in the the Intel Code Builder, is 4GB.
  83.  
  84. For 32-bit Windows development, the only choice as far as I know for
  85. Windows NT is the special version of Microsoft C++ 7.0 that comes with
  86. Windows NT beta developer's kit.  There are 32-bit C compilers for
  87. Windows 3.x, but I wouldn't recommend them since they are not
  88. mainstream.
  89.  
  90. To me, "mainstream" is important because it means a higher quality
  91. product and better support.  It means more complete and more
  92. professionally done documentation.  It means more complete and wider
  93. beta testing.  It means larger resources to fix the bugs that you find
  94. and report in their compiler.
  95.  
  96. In any case, you should get MASM 6.0, which lists for $150.  It is both
  97. a 16-bit and a 32-bit assembler and can link with Microsoft, Borland,
  98. and Intel C compilers.
  99.  
  100. The Intel C Code Builder lists for $595.  I'm not sure of the prices for
  101. Microsoft C++ and Borland C++, but I imagine they are $300 - $500. 
  102.  
  103. >
  104. >3) How robust is C compared to Fortran for purely number crunching, scientific
  105. >   type applications on the PC?
  106.  
  107. C does not do range-checking on array indices.  This is one way that C
  108. is coupled to assembly: a[i] means _exactly_ "add a to i and
  109. dereference".  In fact a[i] and i[a] are synonyms!  If you want to incur
  110. the overhead of range-checking, you could easily do so in C++.
  111.  
  112. One reason that FORTRAN is associated with good number crunching
  113. capabilities is that there exist out there optimized, proven math
  114. libraries.  I would guess that that is not so much of an issue anymore,
  115. that math libraries are available and/or have been ported to C, but I've
  116. never done scientific number crunching in FORTRAN, so I don't know what
  117. I'm missing.
  118.  
  119. >
  120. >4) What books would you recommend in learning C (my wife might want to take
  121. >   classes - I do better teaching myself)?  And of course, since I will be
  122. >   doing programming on a PC, what books would you recommend that are
  123. >   specific to that platform, especially w.r.t. memory management as well
  124. >   as graphics?
  125.  
  126. You should always start out with the official books:
  127.  
  128. For C, it is _The_C_Programming_Langauge_ 2nd ed. by Kernighan & Ritchie
  129. For C++, it is _The_C++_Programming_Language 2nd ed. by Stroustrup
  130. For assembly, it is the programmer's reference manual publsihed by the
  131.     chip's manufacturer.  I would recommend the i486 programmer's
  132.     reference manual published by Intel.  The invaluable quick reference
  133.     guide that comes with MASM 6.0 tells you which instructions are
  134.     available on which processor(8088, 286, 386, and 486).
  135.  
  136. For each language, you may optionally buy a more tutorial or descriptive
  137. book.  The books listed above are more reference books than tutorials.
  138. Although they do start with the basis, and then build on them, they do
  139. so in a math book kind of way.  Just go to a computer book store and
  140. thumb through some of the books and buy the one(s) that appear to teach
  141. the way you like to learn.  Use the reference books to verify the
  142. tutorial books, and to provide complete information.
  143.  
  144. As for memory management, it is a non-issue in the 32-bit world, which
  145. is the way the world is going.  The kluges invented for the 16-bit
  146. DOS world, expanded memory (EMS) and extended memory (XMS) are pretty
  147. technical and not necessary for either 16-bit Windows or 32-bit DOS
  148. extenders.
  149.  
  150. As for graphics, you'll need to use Windows calls to do graphics under
  151. Windows.  I've never done any programming under MS Windows (I wrote my
  152. own windowing system since MS Windows was too slow for the real-time
  153. displays required by my current project), so I don't know any books to
  154. recommend.  To do graphics under DOS, you _might_ find the library calls
  155. that come with the C compiler sufficient.  Most people just write
  156. directly to the VGA registers.  The standard, but _poorly_ written,
  157. guide is called something like _Programming_EGA/VGA_, 2nd edition by
  158. Ferarro.
  159.  
  160. >
  161. >
  162. >Much thanks for your help/advice.
  163. >
  164. >Jon Noring
  165. >
  166. >
  167. >(p.s., I looked for a FAQ about my questions, but did not happen to find one,
  168. >so please no flames in the event there is a FAQ for this.)
  169. >
  170. >-- 
  171. >
  172. >Charter Member of the INFJ Club.
  173.  
  174. - Michael Malak, INTP
  175.  
  176.