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