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


Groups > comp.std.c > #1826

Re: C11 6.3.2.3p7 Referenced Type

From Shao Miller <sha0.miller@gmail.com>
Newsgroups comp.std.c
Subject Re: C11 6.3.2.3p7 Referenced Type
Date 2013-01-07 01:58 -0500
Organization A noiseless patient Spider
Message-ID <kcdrm0$h48$1@dont-email.me> (permalink)
References (1 earlier) <akppc6Favm8U1@mid.individual.net> <kfn1udxdbru.fsf@x-alumni2.alumni.caltech.edu> <akusqqFg0qhU1@mid.individual.net> <kcdj0t$g3v$1@dont-email.me> <kfnk3rpbj3b.fsf@x-alumni2.alumni.caltech.edu>

Show all headers | View raw


On 1/7/2013 01:30, Tim Rentsch wrote:
> Shao Miller <sha0.miller@gmail.com> writes:
>
>> On 1/6/2013 22:13, Wojtek Lerch wrote:
>>>
>>> Consider this simple example:
>>>
>>>     int main( void ) {
>>>       if ( _Alignof(int) <= _Alignof(float) ) {
>>>         float f;
>>>         int n, *p = (int*) &f;
>>>         if ( p == &n )
>>>           puts( "They're equal!" );
>>>       }
>>>     }
>>>
>>> It this program produces output on some implementation, which
>>> requirement of the standard does the implementation violate?  (Chapter
>>> and verse please.)
>>
>> [snip]
>>
>> I don't see why this example should be prohibited.  'n' is never
>> accessed, so an implementation could choose to put it in the same
>> place where 'f' is.  [snip elaboration]
>
> You've made a common mistake here.  You start with a statement
> about something you think an implementation might benefit from
> doing, and use that to draw a conclusion about what the Standard
> allows.  The reasoning process needs to go the other direction:
> start with what the Standard allows (or more importantly in this
> case, what it effectively prohibits), and show that a conforming
> implementation could act as suggested and still not violate any
> requirements.  The reasoning given above proves nothing at all.
>

Actually, you're mistaken.  The statement is _not_ offered as rationale 
for a conclusion for what the Standard allows.  It's just about how a 
particular implementation (I always wonder about one that might seem 
particularly nasty) might _make_use_ of such an allowance, _if_ it exists.

My instinct tells me there's some bit of Standard that's been missed in 
this discussion so far which _prohibits_ the scenario described, but 
that instinct could be mistaken.  _Without_ such a bit of Standard 
having yet been brought forth, "I don't see why this example should be 
prohibited."  Perhaps I should've split that into two paragraphs. :)

I am not an expert on the C11 Standard, so I do not and ought not to 
make any claim about its rationale.  The discussion in this newsgroup 
often seems to yield just the right references to the Standard to 
clarify misunderstandings.  I'm grateful for that.

My apologies for the misunderstanding. :)

- Shao Miller

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


Thread

C11 6.3.2.3p7 Referenced Type Shao Miller <sha0.miller@gmail.com> - 2013-01-04 02:08 -0500
  Re: C11 6.3.2.3p7 Referenced Type Keith Thompson <kst-u@mib.org> - 2013-01-04 08:09 -0800
    Re: C11 6.3.2.3p7 Referenced Type Shao Miller <sha0.miller@gmail.com> - 2013-01-04 12:25 -0500
    Re: C11 6.3.2.3p7 Referenced Type lawrence.jones@siemens.com - 2013-01-04 13:47 -0500
      Re: C11 6.3.2.3p7 Referenced Type Shao Miller <sha0.miller@gmail.com> - 2013-01-04 14:56 -0500
        Re: C11 6.3.2.3p7 Referenced Type lawrence.jones@siemens.com - 2013-01-04 17:10 -0500
          Re: C11 6.3.2.3p7 Referenced Type Shao Miller <sha0.miller@gmail.com> - 2013-01-04 20:34 -0500
  Re: C11 6.3.2.3p7 Referenced Type Wojtek Lerch <wojtek_l@yahoo.ca> - 2013-01-04 23:45 -0500
    Re: C11 6.3.2.3p7 Referenced Type Shao Miller <sha0.miller@gmail.com> - 2013-01-05 02:07 -0500
      Re: C11 6.3.2.3p7 Referenced Type Shao Miller <sha0.miller@gmail.com> - 2013-01-05 02:16 -0500
    Re: C11 6.3.2.3p7 Referenced Type Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-06 17:25 -0800
      Re: C11 6.3.2.3p7 Referenced Type Wojtek Lerch <wojtek_l@yahoo.ca> - 2013-01-06 22:13 -0500
        Re: C11 6.3.2.3p7 Referenced Type Shao Miller <sha0.miller@gmail.com> - 2013-01-06 23:30 -0500
          Re: C11 6.3.2.3p7 Referenced Type Wojtek Lerch <wojtek_l@yahoo.ca> - 2013-01-07 00:07 -0500
            Re: C11 6.3.2.3p7 Referenced Type Shao Miller <sha0.miller@gmail.com> - 2013-01-07 01:29 -0500
              Re: C11 6.3.2.3p7 Referenced Type Shao Miller <sha0.miller@gmail.com> - 2013-01-07 02:18 -0500
              Re: C11 6.3.2.3p7 Referenced Type Wojtek Lerch <wojtek_l@yahoo.ca> - 2013-01-10 17:45 -0500
          Re: C11 6.3.2.3p7 Referenced Type Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-06 22:30 -0800
            Re: C11 6.3.2.3p7 Referenced Type Shao Miller <sha0.miller@gmail.com> - 2013-01-07 01:58 -0500
              Re: C11 6.3.2.3p7 Referenced Type Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-06 23:16 -0800
        Re: C11 6.3.2.3p7 Referenced Type Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-06 22:02 -0800

csiph-web