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


Groups > comp.lang.c > #139190

Re: Multi-channel rand()

Path csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: Multi-channel rand()
Date Fri, 28 Dec 2018 12:36:34 -0800
Organization None to speak of
Lines 53
Message-ID <lnk1jt9ynh.fsf@kst-u.example.com> (permalink)
References <pvrv1d$4ls$1@dont-email.me> <bpNUD.21754$X_3.4267@fx01.am4> <g8ir3lFk9tiU2@mid.individual.net> <lnbm57bq2b.fsf@kst-u.example.com> <aI2VD.166136$9q81.71538@fx12.am4> <e99ff17d-697e-4535-8734-094130ee79fc@googlegroups.com> <q02o8d$2gl$1@dont-email.me> <q02oa9$2gl$2@dont-email.me> <4e3785c7-aae8-4f61-9ac7-8a6b34fce17d@googlegroups.com> <q02r0a$ldd$1@dont-email.me> <27896eaa-d407-4b10-9f00-8144e1e44f5b@googlegroups.com> <q02v7q$fbr$1@dont-email.me> <ad07efe1-837f-4d10-a0ec-502dd4c2d59e@googlegroups.com> <q0331n$72i$1@dont-email.me> <b85be3e3-6a83-41ab-8d03-b5c20e0e9660@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Injection-Info reader01.eternal-september.org; posting-host="04960a3841bac6afd455c79bdf033dd7"; logging-data="13076"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/w37rSt52xEavR3GVgXbGF"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)
Cancel-Lock sha1:oo82N8o+jAb+FjkMHMX/x7/5ysg= sha1:fb2oCk1auybM8ulSMwlq+CybF2k=
Xref csiph.com comp.lang.c:139190

Show key headers only | View raw


James Kuyper <jameskuyper@alumni.caltech.edu> writes:
> On Thursday, December 27, 2018 at 12:44:31 PM UTC-5, Rick C. Hodgin wrote:
>> On 12/27/2018 12:21 PM, James Kuyper wrote:
>> > ...I'm curious - where would you have expected casting
>> > to have occurred, if this hadn't been C?
>> 
>> Nowhere.  In my code I always use things like &rs[i] so that it's
>> conveyed on the source code line that it's a pointer.  And in CAlive
>> there's an option to require that type of explicit casting.
>
> That's not casting. All casting is explicit, and always involves a type
> name surrounded by parentheses. It's also not a type conversion, which
> can occur implicitly. The expression &rs[0] has a different type than rs
> itself, and implicitly going from rs to &rs[0] is described by 6.3.2.1p3
> as a conversion, but it's not a type conversion.
[...]

The standard's use of the word "conversion" is a bit tricky.  My own
preference would be for it to refer only to a run-time operation
that takes a value of one type and yields a corresponding value
of a possibly different type, but the standard uses it in a wider
sense than that.

6.3.2.1p2 defines an *lvalue conversion*, which converts an lvalue
(an expression that designates an object) to "the value stored in
the designated object".

6.3.2.1p3 defines the notorious array-to-pointer conversion, and
p4 defines the conversion of a function designator to a pointer
expression.

All these conversions operate on *expressions*, not on *values*,
and they all occur at compile time.  They don't act like other
type conversions; for example, the result of an array-to-pointer
conversion has nothing to do with the value of the original array
expression.

6.7.6.3 says that parameters of array or function type are "adjusted"
to pointer type.  In my opinion, it would have made more sense for
the expression-to-expression "conversions" defined in 6.3.2.1 to
be described instead as "adjustments".

Note also that these conversions/adjustments cannot be expressed as
casts.

(And of course "%d" is a "conversion specification", but I don't
think anyone is confused by that.)

-- 
Keith Thompson (The_Other_Keith) kst@mib.org  <http://www.ghoti.net/~kst>
Will write code for food.
"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 | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-24 19:54 -0500
  Re: Multi-channel rand() "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-24 19:38 -0800
  Re: Multi-channel rand() nobody@example.org (Scott) - 2018-12-25 04:05 +0000
    Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-24 23:57 -0500
      Re: Multi-channel rand() Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2018-12-25 09:22 +0000
        Professional coders??? (Was: Multi-channel rand()) gazelle@shell.xmission.com (Kenny McCormack) - 2018-12-25 10:09 +0000
        Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-25 07:59 -0500
          Re: Multi-channel rand() Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2018-12-25 21:59 +0000
            Re: Multi-channel rand() nobody@example.org (Scott) - 2018-12-26 02:43 +0000
      Re: Multi-channel rand() rbowman <bowman@montana.com> - 2018-12-25 10:15 -0700
        Re: Multi-channel rand() Keith Thompson <kst-u@mib.org> - 2018-12-25 10:14 -0800
  Re: Multi-channel rand() Anton Shepelev <anton.txt@g{oogle}mail.com> - 2018-12-25 13:35 +0300
    Re: Multi-channel rand() fir <profesor.fir@gmail.com> - 2018-12-25 02:56 -0800
    Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-25 08:02 -0500
  Re: Multi-channel rand() Bart <bc@freeuk.com> - 2018-12-25 11:52 +0000
    Re: Multi-channel rand() Anton Shepelev <anton.txt@g{oogle}mail.com> - 2018-12-25 14:58 +0300
    Re: Multi-channel rand() Richard Damon <Richard@Damon-Family.org> - 2018-12-25 06:59 -0500
      Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-25 08:05 -0500
    Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-25 08:04 -0500
  Re: Multi-channel rand() Bart <bc@freeuk.com> - 2018-12-26 15:48 +0000
    Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-26 07:58 -0800
      Re: Multi-channel rand() Richard Damon <Richard@Damon-Family.org> - 2018-12-26 12:06 -0500
        Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-26 12:45 -0500
          Re: Multi-channel rand() Richard Damon <Richard@Damon-Family.org> - 2018-12-26 13:20 -0500
            Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-26 10:30 -0800
              Re: Multi-channel rand() "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-26 11:35 -0800
                Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-26 14:52 -0500
              Re: Multi-channel rand() Richard Damon <Richard@Damon-Family.org> - 2018-12-26 16:31 -0500
                Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-26 22:28 -0500
                Re: Multi-channel rand() "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-30 20:42 -0800
            Re: Multi-channel rand() Keith Thompson <kst-u@mib.org> - 2018-12-26 15:32 -0800
          Re: Multi-channel rand() Bart <bc@freeuk.com> - 2018-12-26 19:38 +0000
            Re: Multi-channel rand() Keith Thompson <kst-u@mib.org> - 2018-12-26 15:35 -0800
        Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-26 12:59 -0500
          Re: Multi-channel rand() Richard Damon <Richard@Damon-Family.org> - 2018-12-26 16:05 -0500
        Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-26 13:08 -0500
          Re: Multi-channel rand() Richard Damon <Richard@Damon-Family.org> - 2018-12-26 15:50 -0500
      Re: Multi-channel rand() Bart <bc@freeuk.com> - 2018-12-26 17:42 +0000
        Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-26 12:48 -0500
        Re: Multi-channel rand() Richard Damon <Richard@Damon-Family.org> - 2018-12-26 12:58 -0500
          Re: Multi-channel rand() Bart <bc@freeuk.com> - 2018-12-26 19:03 +0000
            Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-26 14:45 -0500
              Re: Multi-channel rand() Bart <bc@freeuk.com> - 2018-12-26 20:46 +0000
                Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-26 16:25 -0500
                Re: Multi-channel rand() Richard Damon <Richard@Damon-Family.org> - 2018-12-26 17:13 -0500
                Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-26 22:23 -0500
                Re: Multi-channel rand() Bart <bc@freeuk.com> - 2018-12-26 23:39 +0000
                Re: Multi-channel rand() Richard Damon <Richard@Damon-Family.org> - 2018-12-26 17:36 -0500
            Re: Multi-channel rand() Richard Damon <Richard@Damon-Family.org> - 2018-12-26 16:27 -0500
    Re: Multi-channel rand() rbowman <bowman@montana.com> - 2018-12-26 19:19 -0700
      Re: Multi-channel rand() Richard Damon <Richard@Damon-Family.org> - 2018-12-26 22:17 -0500
      Re: Multi-channel rand() James Kuyper <jameskuyper@alumni.caltech.edu> - 2018-12-26 19:32 -0800
      Re: Multi-channel rand() Keith Thompson <kst-u@mib.org> - 2018-12-26 19:34 -0800
        Re: Multi-channel rand() Bart <bc@freeuk.com> - 2018-12-27 11:29 +0000
          Re: Multi-channel rand() James Kuyper <jameskuyper@alumni.caltech.edu> - 2018-12-27 05:27 -0800
            Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-27 09:41 -0500
              Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-27 09:42 -0500
                Re: Multi-channel rand() James Kuyper <jameskuyper@alumni.caltech.edu> - 2018-12-27 07:01 -0800
                Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-27 10:28 -0500
                Re: Multi-channel rand() Richard Damon <Richard@Damon-Family.org> - 2018-12-27 10:48 -0500
                Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-27 11:08 -0500
                Re: Multi-channel rand() "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-27 13:49 -0800
                Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-27 17:18 -0500
                Re: Multi-channel rand() "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-29 13:59 -0800
                Re: Multi-channel rand() "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-30 14:01 -0800
                Re: Multi-channel rand() Bart <bc@freeuk.com> - 2018-12-30 22:07 +0000
                Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-30 17:20 -0500
                Re: Multi-channel rand() Richard Damon <Richard@Damon-Family.org> - 2018-12-27 17:47 -0500
                Re: Multi-channel rand() "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-30 20:45 -0800
                Re: Multi-channel rand() James Kuyper <jameskuyper@alumni.caltech.edu> - 2018-12-27 08:22 -0800
                Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-27 11:40 -0500
                Re: Multi-channel rand() James Kuyper <jameskuyper@alumni.caltech.edu> - 2018-12-27 09:21 -0800
                Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-27 12:45 -0500
                Re: Multi-channel rand() James Kuyper <jameskuyper@alumni.caltech.edu> - 2018-12-27 10:57 -0800
                Re: Multi-channel rand() "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-27 14:35 -0500
                Re: Multi-channel rand() Tim Rentsch <txr@alumni.caltech.edu> - 2018-12-28 09:25 -0800
                Re: Multi-channel rand() Tim Rentsch <txr@alumni.caltech.edu> - 2018-12-28 09:55 -0800
                Re: Multi-channel rand() Keith Thompson <kst-u@mib.org> - 2018-12-28 12:36 -0800
                Re: Multi-channel rand() Robert Wessel <robertwessel2@yahoo.com> - 2018-12-27 20:34 -0600
              Re: Multi-channel rand() Richard Damon <Richard@Damon-Family.org> - 2018-12-27 10:37 -0500
            Re: Multi-channel rand() Bart <bc@freeuk.com> - 2018-12-27 14:46 +0000
              Re: Multi-channel rand() James Kuyper <jameskuyper@alumni.caltech.edu> - 2018-12-27 07:05 -0800
                Re: Multi-channel rand() Keith Thompson <kst-u@mib.org> - 2018-12-27 11:28 -0800
                Re: Multi-channel rand() James Kuyper <jameskuyper@alumni.caltech.edu> - 2018-12-27 12:07 -0800
                Re: Multi-channel rand() Keith Thompson <kst-u@mib.org> - 2018-12-27 12:47 -0800
                Re: Multi-channel rand() James Kuyper <jameskuyper@alumni.caltech.edu> - 2018-12-27 14:47 -0800
  Re: Multi-channel rand() "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-26 11:58 -0800

csiph-web