Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #43995

Re: pass by address

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: pass by address
Date 2014-05-04 01:29 -0700
Organization None to speak of
Message-ID <lnvbtmj6aj.fsf@nuthaus.mib.org> (permalink)
References (3 earlier) <bfa8m9hgf8af40gkotf6mgv3ke08mpep0d@4ax.com> <lk31k5$f9h$1@dont-email.me> <lnd2fulkqv.fsf@nuthaus.mib.org> <lk3ml7$fb8$1@speranza.aioe.org> <lk4efb$vj2$1@dont-email.me>

Show all headers | View raw


"Bill Cunningham" <nospam@nspam.invalid> writes:
[...]
>     It wasn't the compiler it was the indent program. It mentioned = &.

Surprisingly, GNU indent 2.2.11 does produce a warning for
    p=&a;
namely:
   Warning:old style assignment ambiguity in "=&".  Assuming "= &"

Of course you did explicitly say it was the compiler.  And you wouldn't
have seen the warning if you had simply copied the code that Lew
suggsted to you without deleting the whitespace.

> I can't seem to remember how to redirect stderr now.

You can't copy-and-paste an error message?

>                                                      And this code
> works. So I don't know why people are telling me it doesn't.

I don't recall anyone telling you Lew's code wouldn't work.  Here it is,
in its entirety:

  int a = 15;
  int *p;

  p = &a;

  printf("%d\n",*p);
  scanf("%d\n",p);

I see nothing wrong with it (apart from the poor behavior of scanf on
certain forms of bad input, but that's beside the point).

[...]

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

pass by address "Bill Cunningham" <nosapm@nspam.invalid> - 2014-05-02 16:53 -0400
  Re: pass by address "Bill Cunningham" <nosapm@nspam.invalid> - 2014-05-02 17:03 -0400
    Re: pass by address "Bill Cunningham" <nosapm@nspam.invalid> - 2014-05-02 17:20 -0400
  Re: pass by address Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-05-02 17:58 -0400
    Re: pass by address "Bill Cunningham" <nosapm@nspam.invalid> - 2014-05-02 18:09 -0400
      Re: pass by address Barry Schwarz <schwarzb@dqel.com> - 2014-05-02 16:37 -0700
        Re: pass by address gazelle@shell.xmission.com (Kenny McCormack) - 2014-05-02 23:43 +0000
          Re: pass by address Richard <rgrdev_@gmail.com> - 2014-05-03 15:58 +0200
            Re: pass by address gazelle@shell.xmission.com (Kenny McCormack) - 2014-05-03 14:08 +0000
              Re: pass by address Barry Schwarz <schwarzb@dqel.com> - 2014-05-03 10:38 -0700
                Re: pass by address Richard <rgrdev_@gmail.com> - 2014-05-03 21:13 +0200
        Re: pass by address "Bill Cunningham" <nosapm@nspam.invalid> - 2014-05-03 01:46 -0400
        Re: pass by address "Bill Cunningaham" <nospam@nspam.invalid> - 2014-05-03 11:22 -0400
          Re: pass by address James Kuyper <jameskuyper@verizon.net> - 2014-05-03 12:13 -0400
          Re: pass by address Keith Thompson <kst-u@mib.org> - 2014-05-03 12:34 -0700
            Re: pass by address Richard <rgrdev_@gmail.com> - 2014-05-03 22:33 +0200
            Re: pass by address glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-05-03 21:21 +0000
              Re: pass by address "Bill Cunningham" <nospam@nspam.invalid> - 2014-05-04 00:08 -0400
                Re: pass by address Barry Schwarz <schwarzb@dqel.com> - 2014-05-03 21:52 -0700
                Re: pass by address Tonton Th <tth@nowhere.invalid> - 2014-05-04 08:44 +0000
                Re: pass by address Keith Thompson <kst-u@mib.org> - 2014-05-04 01:51 -0700
                Re: pass by address "Bill Cunningham" <nospam@nspam.invalid> - 2014-05-04 15:06 -0400
                Re: pass by address Barry Schwarz <schwarzb@dqel.com> - 2014-05-04 15:35 -0700
                Re: pass by address Richard <rgrdev_@gmail.com> - 2014-05-05 12:01 +0200
                Re: pass by address Barry Schwarz <schwarzb@dqel.com> - 2014-05-05 11:46 -0700
                Re: pass by address "Bill Cunningham" <nospam@nspam.invalid> - 2014-05-05 14:18 -0400
                Re: pass by address Barry Schwarz <schwarzb@dqel.com> - 2014-05-05 11:55 -0700
                Re: pass by address "Bill Cunningham" <nospam@nspam.invalid> - 2014-05-05 15:20 -0400
                Re: pass by address "Bill Cunningham" <nospam@nspam.invalid> - 2014-05-05 15:23 -0400
                Re: pass by address Ken Brody <kenbrody@spamcop.net> - 2014-05-06 11:02 -0400
                Re: pass by address "Bill Cunningham" <nospam@nspam.invalid> - 2014-05-06 14:46 -0400
                Re: pass by address Richard <rgrdev_@gmail.com> - 2014-05-05 12:00 +0200
                Re: pass by address Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-05-05 14:50 -0700
                Re: pass by address "Bill Cunningham" <nospam@nspam.invalid> - 2014-05-05 23:13 -0400
                Re: pass by address "Osmium" <r124c4u102@comcast.net> - 2014-05-05 23:09 -0500
                Re: pass by address "Bill Cunningham" <nospam@nspam.invalid> - 2014-05-06 08:55 -0400
                Re: pass by address Ken Brody <kenbrody@spamcop.net> - 2014-05-06 11:16 -0400
                Re: pass by address Richard <rgrdev_@gmail.com> - 2014-05-06 18:13 +0200
                Re: pass by address Kaz Kylheku <kaz@kylheku.com> - 2014-05-04 21:06 +0000
                Re: pass by address Kaz Kylheku <kaz@kylheku.com> - 2014-05-04 23:50 +0000
                Re: pass by address Keith Thompson <kst-u@mib.org> - 2014-05-04 12:36 -0700
                Re: pass by address "Bill Cunningham" <nospam@nspam.invalid> - 2014-05-05 14:21 -0400
                Re: pass by address Keith Thompson <kst-u@mib.org> - 2014-05-04 01:29 -0700
                Re: pass by address "Bill Cunningham" <nospam@nspam.invalid> - 2014-05-04 15:09 -0400
        Re: pass by address "Bill Cunningaham" <nospam@nspam.invalid> - 2014-05-03 11:32 -0400
  Re: pass by address Barry Schwarz <schwarzb@dqel.com> - 2014-05-02 16:43 -0700
    Re: pass by address "Bill Cunningham" <nosapm@nspam.invalid> - 2014-05-03 01:54 -0400
      Re: pass by address Richard <rgrdev_@gmail.com> - 2014-05-03 15:59 +0200
    Re: pass by address "Bill Cunningham" <nosapm@nspam.invalid> - 2014-05-03 02:08 -0400
      Re: pass by address "Bill Cunningaham" <nospam@nspam.invalid> - 2014-05-03 11:46 -0400
    Re: pass by address Kaz Kylheku <kaz@kylheku.com> - 2014-05-03 21:43 +0000

csiph-web