home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / vms / 19929 < prev    next >
Encoding:
Internet Message Format  |  1992-12-27  |  1.8 KB

  1. Path: sparky!uunet!stanford.edu!agate!ucbvax!lrw.com!leichter
  2. From: leichter@lrw.com (Jerry Leichter)
  3. Newsgroups: comp.os.vms
  4. Subject: re: C pointer question
  5. Message-ID: <9212271645.AA05429@uu3.psi.com>
  6. Date: 27 Dec 92 13:09:27 GMT
  7. Sender: usenet@ucbvax.BERKELEY.EDU
  8. Organization: The Internet
  9. Lines: 40
  10.  
  11.  
  12.     I am porting some C code to the VAX, and am having many problems.  One
  13.     of them was fixed by DEC Support (after a lot of feeling around) by
  14.     changing this:
  15.     void foo(char a[])
  16.     {
  17.     bar(a);
  18.     }
  19.  
  20.     to this:
  21.     void foo(char a[])
  22.     {
  23.     bar(&a);
  24.     }
  25.  
  26. There is NO difference between these two pieces of code.  In fact, the first
  27. one has historically been illegal ("a" is not an lvalue) but has been widely
  28. accepted as a synonymn for the latter.  I'm not absolutely certain, but I
  29. think ANSI C actually sanctioned this common convenention.
  30.  
  31.     bar wants a char *, foo is passed a char *.  What am I doing wrong?
  32.     What is VMS C doing to my previously working code?  Any suggestions?
  33.  
  34. Sure.  ASK AN INTELLIGENT QUESTION!  How in the world do you expect ANYONE to
  35. answer so stupid and pointless a question as "what am I doing wrong?" when you
  36. haven't described what you are DOING?
  37.  
  38. All I can conclude is that, if your programming ability is up to the level of
  39. your ability to ask an intelligent question, it's not surprising that you are,
  40. as you say, "having many problems."  There's probably not a line of code
  41. anywhere in the system you are describing that makes sense.
  42.  
  43. To those net monitors out there who will claim that I shouldn't insult someone
  44. for asking a question:  Feel free to do so, AFTER you've answered one tenth as
  45. many questions - from beginners and otherwise - as I have.  It's one thing to
  46. ask a beginner's question; it's another to say "My code [NOT shown] doesn't
  47. work, what's wrong."  The latter is a total waste of EVERYONE'S time.
  48.  
  49.                             -- Jerry
  50.  
  51.