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


Groups > comp.std.c > #1805

C11 6.3.2.3p7 Referenced Type

From Shao Miller <sha0.miller@gmail.com>
Newsgroups comp.std.c
Subject C11 6.3.2.3p7 Referenced Type
Date 2013-01-04 02:08 -0500
Organization A noiseless patient Spider
Message-ID <kc5v4n$ing$1@dont-email.me> (permalink)

Show all headers | View raw


I noticed a change between N1256 and N1570:

   "A pointer to an object type may be converted to a pointer to a 
different object type. If the resulting pointer is not correctly 
aligned68) for the referenced type, the behavior is undefined. 
Otherwise, when converted back again, the result shall compare equal to 
the original pointer. When a pointer to an object is converted to a 
pointer to a character type, the result points to the lowest addressed 
byte of the object. Successive increments of the result, up to the size 
of the object, yield pointers to the remaining bytes of the object."

"Referenced type"?  Is this:
   1. The original type of the value to undergo conversion?
   2. The target type of the converted value?
   3. The original type of the pointee that is pointed-to by the value 
to undergo conversion?
   4. The pointed-to type that is the type whence the target type is 
derived?

The C99 wording:

   "A pointer to an object or incomplete type may be converted to a 
pointer to a different object or incomplete type. If the resulting 
pointer is not correctly aligned57) for the pointed-to type, the 
behavior is undefined. Otherwise, when converted back again, the result 
shall compare equal to the original pointer. When a pointer to an object 
is converted to a pointer to a character type, the result points to the 
lowest addressed byte of the object. Successive increments of the 
result, up to the size of the object, yield pointers to the remaining 
bytes of the object."

Has this already been discussed, before?  Has this been adjusted in the 
actual Standards?

I wouldn't've guessed that a conversion resulting in an rvalue would 
have any alignment concerns for the rvalue itself, so I'd cross out #1 
and #2.  The C99 "pointed-to" following closely after "resulting 
pointer" makes me think #4, but now it's gone from C11, so I'm more 
concerned about which is right.

- Shao Miller

Back to comp.std.c | Previous | Next — 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