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


Groups > comp.lang.forth > #52666

Re: Average swaps per word?

From Andrew Haley <andrew29@littlepinkcloud.invalid>
Subject Re: Average swaps per word?
Newsgroups comp.lang.forth
References (4 earlier) <o0af90$5sf$1@cherry.spenarnc.xs4all.nl> <871syff9mv.fsf@nightsong.com> <2016Nov14.184256@mips.complang.tuwien.ac.at> <ebednWz3M_48RrfFnZ2dnUU7-fHNnZ2d@supernews.com> <20161115174906.792ede7c@_>
Message-ID <AvSdnWdgOaGTvbHFnZ2dnUU7-W-dnZ2d@supernews.com> (permalink)
Date 2016-11-16 02:59 -0600

Show all headers | View raw


Rod Pemberton <NeedNotReplyHere@xrsevnneqk.cem> wrote:
> On Tue, 15 Nov 2016 03:55:45 -0600
> Andrew Haley <andrew29@littlepinkcloud.invalid> wrote:
> 
>> Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>> 
>> > Looking at the C11 standard for memset_s, I did not see anything
>> > that would keep a sufficiently adverserial compiler writer from
>> > optimizing it away.  It says:
>> > 
>> > |Unlike memset, any call to the memset_s function shall be evaluated
>> > |strictly according to the rules of the abstract machine as
>> > described |in (5.1.2.3). That is, any call to the memset_s function
>> > shall assume |that the memory indicated by s and n may be
>> > accessible in the future |and thus must contain the values
>> > indicated by c.
>> > 
>> > Now, everything else (including memset()) in the standard also is
>> > evaluated according to the rules of the abstract machine, and the
>> > "optimization" comes in afterwards, applies the as-if rule, and
>> > poof, memset() is gone, and so is memset_s().  From what I read,
>> > "volatile" is not specified very clearly, so it probably has this
>> > problem and more.  
>> 
>> That's true, but I don't believe that it's possible to do any better
>> with a language specification based on an abstract machine.  C11 still
>> says that
>> 
>>   What constitutes an access to an object that has volatile-qualified
>>   type is implementation-defined.
>> 
>> so it's possible for an "adversarial compiler" to optimize away
>> volatile too.  I don't think any do, though, which is perhaps the
>> point.
>> 
> 
> Optimizing away volatile would defeat the purpose of having volatile
> implemented by the language, wouldn't it?

That's why they don't do it.

> I would think that phrase more likely means that volatile can be
> entirely optional, or that the precise implementation details of
> volatile is specific to each platform.  I'd guess that most C
> compilers are likely to choose the latter, implementing volatile,
> since most also support casting integers into pointers, which is
> undefined or implementation-defined behavior too.

Of course.

> But, you could have a pedantic C compiler which doesn't support
> volatile at all due to it being non-portable.  Well, that's what
> that means to me, anyway.
> 
> If it's seriously an issue for Anton, there is always comp.std.c to
> which he post, but a quick scan doesn't show any posts from the C
> experts who contributed to and wrote the C specifications who posted
> there years ago.

It's not a serious issue from a practical C user's point of view, but
it does point to the limitations of what it's possible to do in a
programming language specification.

Andrew.

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Average swaps per word? trans <transfire@gmail.com> - 2016-11-08 22:03 -0800
  Re: Average swaps per word? "Elizabeth D. Rather" <erather@forth.com> - 2016-11-08 20:20 -1000
  Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-09 08:16 +0000
  Re: Average swaps per word? Rod Pemberton <NeedNotReplyHere@xrsevnneqk.cem> - 2016-11-09 03:34 -0500
    Re: Average swaps per word? trans <transfire@gmail.com> - 2016-11-09 02:53 -0800
      Re: Average swaps per word? rickman <gnuarm@gmail.com> - 2016-11-09 11:50 -0500
        Re: Average swaps per word? stephen@mpeforth.com (Stephen Pelc) - 2016-11-09 18:37 +0000
          Re: Average swaps per word? Harold <hzrabbie@gmail.com> - 2016-11-10 16:28 -0800
            Re: Average swaps per word? stephen@mpeforth.com (Stephen Pelc) - 2016-11-11 17:51 +0000
            Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-12 12:23 +0000
              Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-12 16:09 +0100
                Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-13 14:55 +0000
                Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-13 20:34 +0100
                Re: Average swaps per word? Paul Rubin <no.email@nospam.invalid> - 2016-11-13 11:43 -0800
                Re: Average swaps per word? hughaguilar96@gmail.com - 2016-11-13 16:58 -0800
                Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-14 16:41 +0100
                Re: Average swaps per word? hughaguilar96@gmail.com - 2016-11-14 16:38 -0800
                Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-14 17:42 +0000
                Re: Average swaps per word? Rod Pemberton <NeedNotReplyHere@xrsevnneqk.cem> - 2016-11-14 16:39 -0500
                Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-17 12:40 +0000
                Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-17 14:10 +0100
                Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-18 15:14 +0000
                Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-20 18:16 +0100
                Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-22 10:29 +0000
                Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-22 15:54 +0100
                Re: Average swaps per word? James Kuyper <jameskuyper@verizon.net> - 2016-11-22 11:50 -0500
                Re: Average swaps per word? raltbos@xs4all.nl (Richard Bos) - 2016-11-24 17:27 +0000
                Re: Average swaps per word? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-15 03:55 -0600
                Re: Average swaps per word? Rod Pemberton <NeedNotReplyHere@xrsevnneqk.cem> - 2016-11-15 17:49 -0500
                Re: Average swaps per word? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-16 02:59 -0600
                Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-17 13:07 +0000
                Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-16 22:57 +0000
                Re: Average swaps per word? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-17 03:12 -0600
                Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-17 12:32 +0100
                Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-18 15:02 +0000
                Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-17 13:23 +0000
                Re: Average swaps per word? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-17 08:54 -0600
                Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-18 15:54 +0000
                Re: Average swaps per word? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-18 12:37 -0600
                Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-14 17:32 +0000
                Re: Average swaps per word? Mark Wills <markwills1970@gmail.com> - 2016-11-15 02:09 -0800
                Re: Average swaps per word? jim <anon@example.com> - 2016-11-15 10:44 +0000
                Re: Average swaps per word? Mark Wills <markwills1970@gmail.com> - 2016-11-15 03:12 -0800
                Re: Average swaps per word? Alex <alex@rivadpm.com> - 2016-11-15 13:01 +0000
                Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-17 12:51 +0000
                Re: Average swaps per word? Alex <alex@rivadpm.com> - 2016-11-17 14:02 +0000
                Re: Average swaps per word? Alex <alex@rivadpm.com> - 2016-11-17 14:06 +0000
                Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-18 15:26 +0000
                Re: Average swaps per word? Alex <alex@rivadpm.com> - 2016-11-18 18:33 +0000
                Re: Average swaps per word? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-19 03:32 -0600
                Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-17 14:29 +0100
                Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-15 13:51 +0100
                Re: Average swaps per word? jim <anon@example.com> - 2016-11-15 13:01 +0000
                Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-17 12:46 +0000
                Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-17 14:16 +0100
              Re: Average swaps per word? Harold <hzrabbie@gmail.com> - 2016-11-13 11:08 -0800
                Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-14 17:08 +0000
                Re: Average swaps per word? Mark Wills <markwills1970@gmail.com> - 2016-11-15 02:04 -0800
                Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-15 14:04 +0100
                Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-15 14:05 +0100
                Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-17 12:58 +0000
                Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-17 15:16 +0100
                Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-18 15:41 +0000
                Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-20 18:12 +0100
  Re: Average swaps per word? minforth@arcor.de - 2016-11-09 03:15 -0800
    Re: Average swaps per word? trans <transfire@gmail.com> - 2016-11-09 11:22 -0800
    Re: Average swaps per word? "HAA" <someone@microsoft.com> - 2016-11-10 12:20 +1100
      Re: Average swaps per word? "Elizabeth D. Rather" <erather@forth.com> - 2016-11-09 21:04 -1000
      Re: Average swaps per word? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-10 03:45 -0600
        Re: Average swaps per word? rickman <gnuarm@gmail.com> - 2016-11-10 11:52 -0500
          Re: Average swaps per word? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-10 11:42 -0600
            Re: Average swaps per word? rickman <gnuarm@gmail.com> - 2016-11-10 13:34 -0500
              Re: Average swaps per word? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-10 12:54 -0600
                Re: Average swaps per word? rickman <gnuarm@gmail.com> - 2016-11-10 16:33 -0500
                Re: Average swaps per word? "Elizabeth D. Rather" <erather@forth.com> - 2016-11-10 15:56 -1000
                Re: Average swaps per word? rickman <gnuarm@gmail.com> - 2016-11-10 21:30 -0500
                Re: Average swaps per word? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-11 03:04 -0600
                Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-12 13:25 +0000
                Re: Average swaps per word? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-14 03:34 -0600
                Re: Average swaps per word? Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2016-11-11 10:41 +0000
                Re: Average swaps per word? hughaguilar96@gmail.com - 2016-11-11 16:45 -0800
      Re: Average swaps per word? jim <anon@example.com> - 2016-11-10 11:17 +0000
        Re: Average swaps per word? Raimond Dragomir <raimond.dragomir@gmail.com> - 2016-11-10 04:34 -0800
          Re: Average swaps per word? jim <anon@example.com> - 2016-11-10 12:44 +0000
            Re: Average swaps per word? Raimond Dragomir <raimond.dragomir@gmail.com> - 2016-11-10 07:27 -0800
              Re: Average swaps per word? Ron Aaron <rambamist@gmail.com> - 2016-11-10 18:26 +0200
              Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-10 16:05 +0000
        Re: Average swaps per word? stephen@mpeforth.com (Stephen Pelc) - 2016-11-10 14:55 +0000
          Re: Average swaps per word? "HAA" <someone@microsoft.com> - 2016-11-12 11:36 +1100
            Re: Average swaps per word? hughaguilar96@gmail.com - 2016-11-11 16:56 -0800
            Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-12 16:14 +0100
          Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-12 12:14 +0000
            Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-12 16:16 +0100
              Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-13 14:51 +0000
                Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-13 20:41 +0100
      Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-10 14:42 +0000
  Re: Average swaps per word? hughaguilar96@gmail.com - 2016-11-11 15:54 -0800

csiph-web