home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 18973 < prev    next >
Encoding:
Text File  |  1992-12-29  |  4.8 KB  |  101 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!cs.utexas.edu!csc.ti.com!tilde.csc.ti.com!mksol!mccall
  3. From: mccall@mksol.dseg.ti.com (fred j mccall 575-3539)
  4. Subject: Re: Moving from Pascal to C, Help please!!!!!!
  5. Message-ID: <1992Dec29.142516.4334@mksol.dseg.ti.com>
  6. Organization: Texas Instruments Inc
  7. References: <78858@hydra.gatech.EDU>
  8. Date: Tue, 29 Dec 1992 14:25:16 GMT
  9. Lines: 90
  10.  
  11. In <78858@hydra.gatech.EDU> gt6758b@prism.gatech.EDU (Michael Maverick Kopack) writes:
  12.  
  13. >Could somebody please tell me how I should go about trying to learn C? I've
  14. >gotten SAS/C 6.1, but really don't understand what I'm doing with it. My
  15. >programming experience has been limited to PASCAL and BASIC and LISP. Heck,
  16. >they don't even teach C here at GT!  I co-op with a government research center
  17. >and they have taught me a little, but I'm having a really big problem 
  18. >understanding the stuff with pointers.
  19.  
  20. Pointers and recursion are the basics of the language.  If you don't
  21. get them, you aren't going to get it at all.
  22.  
  23. >I have been reading through a book called "C as a second language for PASCAL
  24. >programmers" and have the most recent copy of the CManual disks in the Fish
  25. >collection printed out. Are there any resources I could use that would give
  26. >me a good, solid understanding of C.... I don't care about being able to do all
  27. >the wiz-bang graphics and such yet, I just want to be able to write a few
  28. >useful programs in C for my Amiga!
  29.  
  30. Get hold of a copy of Kernighan & Ritchie and read it.  Then go back
  31. and read it again.  Then read it a third time and work through the
  32. exercises.
  33.  
  34. >There are a lot of things about C that I find very frustrating after comming
  35. >from a decent course in Pascal. For one is the way that Arrays are handled.
  36. >I like being able to do stuff like    array [6..26] of int whereas in C you
  37. >get forced into calling the indeces 0-19. I also HATE that there are no true 
  38. >pass by reference parameters! 
  39.  
  40. Sure there are.  What do you think passing a pointer to something IS?
  41. What do you think a call by reference does?  What do you think Pascal
  42. VAR does?
  43.  
  44. >It seems that C pretty much took Pascal and threw all the rules out the window!
  45.  
  46. Just a bit off there.  C was created to write programs.  Pascal was
  47. created to teach BASIC principles of programming.  Big difference.  No
  48. relationship between the two (to speak of).
  49.  
  50. >I can't imbed functions so other procedures can't see them (scoping rules),
  51.  
  52. This is done using separate files in C.  If you structure your program
  53. in the first place, scoping ceases to be a problem.
  54.  
  55. >I have to use global variables a lot (taught as a no-no at GT) and it just
  56. >seems like C is TOO flexible! How do you guys get anything done when there are
  57. >about 500 different ways to do it?
  58.  
  59. If you properly break the functionality of your program up into
  60. separate compilation modules, you will find yourself using what I call
  61. 'local globals' -- they are visible in one file, but are only used by
  62. related functions and aren't visible outside the 'package'.  And just
  63. how is that different than 'scoped variables' in Pascal?  Whoever
  64. taught you that global variables are bad should have taught you WHY
  65. global variables are bad.  Beginning C programmers tend to overuse
  66. globals because they don't understand how to structure their programs. 
  67.  
  68. How do you get anything done when there is only one way to do it and
  69. that way doesn't work too well?  If there is more than one way to do
  70. something (and there usually is), you pick the best way and do it that
  71. way.  How do you ever get to class?  There must be hundreds of paths
  72. you could follow to get there.
  73.  
  74. >Please, open my mind to C! 
  75.  
  76. Well, I'm of the opinion that if you don't like it you shouldn't use
  77. it.  If you find that you can't do the things you need to do in a
  78. language that you DO like, that says that the one you like is
  79. deficient and you need to learn another one.  If you CAN do everything
  80. you need to do in the language that you like, then USE THAT LANGUAGE.
  81. Seems like one of the things they never teach people these days is the
  82. criteria to use when selecting a language to do a job.  I hardly think
  83. it's up to us to 'open your mind to C' -- if you don't see any utility
  84. in the power of the language, use something else.
  85.  
  86. >I'd hate to have to try to do everything for my 
  87. >Amiga in Pascal, considering how much of the Amiga software is written in 
  88. >and documented for C......
  89.  
  90. Perhaps you should ask some of the people who wrote all that software
  91. why they did it in C and not in Pascal?
  92.  
  93. [Now then, language wars are incredibly boring, so why not just ask
  94. questions about how to do the things you're hanving problems with?]
  95.  
  96. -- 
  97. "Insisting on perfect safety is for people who don't have the balls to live
  98.  in the real world."   -- Mary Shafer, NASA Ames Dryden
  99. ------------------------------------------------------------------------------
  100. Fred.McCall@dseg.ti.com - I don't speak for others and they don't speak for me.
  101.