Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion standard pragma's II

Path: g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: Keith Thompson <ks...@mib.org>
Newsgroups: comp.lang.c,de.comp.lang.c,comp.std.c,comp.lang.fortran
Subject: Re: standard pragma's II
Date: Fri, 29 Oct 2010 09:36:15 -0700
Organization: None to speak of
Lines: 44
Message-ID: <lnd3qtklc0.fsf@nuthaus.mib.org>
References: <ZNmdnQ1E8YWoHSjRnZ2dnUVZ5omdnZ2d@giganews.com>
	<RfKdnTBCecZ56iPRnZ2dnUVZ5sudnZ2d@giganews.com>
	<i9p6fr$408$1@news.eternal-september.org>
	<i9phgb$17v$1@gosset.csi.cam.ac.uk> <lnwrpb1stj.fsf@nuthaus.mib.org>
	<srqdnT3Ey4TrP17RnZ2dnUVZ5u6dnZ2d@giganews.com>
	<iacm02$9kq$1@news.eternal-september.org>
	<iacmuk$f2$1@news.eternal-september.org>
	<iacqic$5al$2@news.eternal-september.org>
	<iaddfv$ael$1@news.eternal-september.org>
	<8j04c2Fmu0U1@mid.individual.net> <ln39rpm3r5.fsf@nuthaus.mib.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: mx03.eternal-september.org; posting-host="9nFTuw1iclElqUG5+//YDQ";
	logging-data="22450"; mail-complaints-to="ab...@eternal-september.org";	posting-account="U2FsdGVkX1/HLGF1Bh7GVyNQmCj9RgYO"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)
Cancel-Lock: sha1:zpoiGP42NtPqcZosvJqTj5Loxcs=
	sha1:NpfgySJkumGOUdXGZn7APWHkdSc=

Keith Thompson <ks...@mib.org> writes:
> Dick Hendrickson <dick.hendrick...@att.net> writes:
> [snip]
[...]
>>         subroutine silly (a,b)
>>         a = a/27.0
>>         b = 1.0
>>         end
[...]
> The C equivalent of the above would have to use pointers, since
> all arguments are passed by value:
>
>     void silly(double *a, double *b) {
>         a /= 27.0;
>         b = 1.0;
>     }

Whoops, I forgot to dereference the pointer parameters.  That should be:

    void silly(double *a, double *b) {
        *a /= 27.0;
        *b = 1.0;
    }

 *think* that the "restrict" qualifier would give the compiler
> the same freedom a Fortran compiler would have:
>
>     void silly(double *restrict a, double *restrict b) {
>         a /= 27.0;
>         b = 1.0;
>     }

And likewise.

> But I don't claim to understand "restrict" fully, so I'm not certain
> of this.

See also James Kuyper's followup.

-- 
Keith Thompson (The_Other_Keith) ks...@mib.org  <http://www.ghoti.net/~kst>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"