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


Groups > comp.lang.c > #112074

Re: Arrays sorting!!

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.lang.c
Subject Re: Arrays sorting!!
Date 2017-06-12 21:22 +0200
Organization A noiseless patient Spider
Message-ID <ohmpff$vch$1@dont-email.me> (permalink)
References <ohl2ii$b85$2@gioia.aioe.org> <54a4187b-61cc-4acb-b71c-4a3021d54405@googlegroups.com> <BRv%A.173442$6r7.45165@fx34.am4> <U4w%A.40744$9M.16883@fx18.am4> <6681ba5c-0f02-40f2-9381-13c254b01843@googlegroups.com>

Show all headers | View raw


On 12/06/17 16:36, supercat@casperkitty.com wrote:
> On Monday, June 12, 2017 at 7:49:00 AM UTC-5, Bart wrote:
>> On second thoughts, that might not matter. The array access can be well
>> in bounds, but it's using an element that is not initialised.
> 
> Under C11, if an automatic-duration object is not initialized but its address
> is taken, and if the type is one without any trap representations, conforming
> implementations are required to ensure that reading the variable will yield
> some (possibly arbitrary) value of that type.
> 

6.7.9 (Initialization):

"If an object that has automatic storage duration is not initialized 
explicitly, its value is indeterminate."


Annex J.2 has a list of undefined behaviour, including:

"the value of an object with automatic storage duration is used while it 
is indeterminate (6.2.4, 6.7.9, 6.8)."



To me, that sounds like using the value of an uninitialised automatic 
storage object, before it has been written, is undefined behaviour. 
This appears to be the case whether you read it directly, or if you take 
a pointer and read through that.

Can you give the reference in C11 for your interpretation of something 
different?

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


Thread

Arrays sorting!! Christopher <info@invalid.invalid> - 2017-06-12 04:55 +0100
  Re: Arrays sorting!! luser droog <luser.droog@gmail.com> - 2017-06-11 21:30 -0700
    Re: Arrays sorting!! bartc <bc@freeuk.com> - 2017-06-12 13:32 +0100
      Re: Arrays sorting!! bartc <bc@freeuk.com> - 2017-06-12 13:48 +0100
        Re: Arrays sorting!! supercat@casperkitty.com - 2017-06-12 07:36 -0700
          Re: Arrays sorting!! David Brown <david.brown@hesbynett.no> - 2017-06-12 21:22 +0200
            Re: Arrays sorting!! supercat@casperkitty.com - 2017-06-12 14:00 -0700
              Re: Arrays sorting!! David Brown <david.brown@hesbynett.no> - 2017-06-12 23:39 +0200
                Re: Arrays sorting!! "James R. Kuyper" <jameskuyper@verizon.net> - 2017-06-12 18:47 -0400
  Re: Arrays sorting!! Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-12 12:03 +0100
    Re: Arrays sorting!! "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2017-06-12 20:23 +0800
      Re: Arrays sorting!! mark.bluemel@gmail.com - 2017-06-12 07:32 -0700
        Re: Arrays sorting!! "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2017-06-12 23:06 +0800
      Re: Arrays sorting!! Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-12 16:08 +0100
        Re: Arrays sorting!! "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2017-06-12 23:11 +0800
          Re: Arrays sorting!! Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-12 16:46 +0100
            Re: Arrays sorting!! "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2017-06-13 17:49 +0800
    Re: Arrays sorting!! Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-12 15:57 +0100
  Re: Arrays sorting!! Real Troll <Real.Troll@Trolls.com> - 2017-06-12 16:55 -0400

csiph-web