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


Groups > comp.std.c++ > #146

Re: Compound types as functions in latest C++ standard

Message-ID <2011050320582178262-pete@versatilecodingcom> (permalink)
Newsgroups comp.std.c++
From Pete Becker <pete@versatilecoding.com>
Subject Re: Compound types as functions in latest C++ standard
Organization Roundhouse Consulting, Ltd.
References <ipk3tb$6jd$1@dont-email.me> <ipnn44$efa$1@dont-email.me>
Date 2011-05-04 12:46 -0600

Show all headers | View raw


On 2011-05-03 15:32:00 -0400, Edward Diener said:

On 5/2/2011 3:10 PM, Francis Glassborow wrote:
>
>
>> On 01/05/2011 19:52, Edward Diener wrote:
>>
>>
>>> In the latest C++ standard document (n3290) in section 3.9.2 part 1,
>>> where it mentions the ways in which compound types can be constructed
>>> I read:
>>>
>>> "=97 functions, which have parameters of given types and return void or
>>> references or objects of a given type, 8.3.5;"
>>>
>>> Should not this say "... return void or references or pointers or
>>> objects of a given type, 8.3.5;", or better yet just say "... return
>>> void or given types, 8.3.5;".
>>>
>>>
>>> Strictly speaking a pointer is an object. References are not objects. A
>>>
>> function does not and cannot return a type. So the wording is correct as
>> it stands.
>>
>>
> I did not realize that "a pointer is an object" in C++ standards
> terminology. In that case the original wording is perfectly correct.
>
> I do think it is natural to have assumed that "an object" meant something
> different. One often refers to "pointers to objects" or "references to
> objects" to distinguish objects themselves from the pointer or reference
> wa=
> y
> of specifying an object.
>

"object" as it's used in the standard is a compiler writer's term, not an
object-oriented programming term. An object is a region of storage and the
operations that are associated with it. So a pointer to an object is an
object, and, recursively, a pointer to a pointer to an object is also an
object. Since a reference doesn't have memory associated with it (although
it may be a pointer under the hood), it isn't an object; further, there are
no operations on references, only operations on the thing that's referred
to, so it isn't an object.

-- 
 Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference (
www.petebecker.com/tr1book)


[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]

Back to comp.std.c++ | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Compound types as functions in latest C++ standard Edward Diener <eldiener@tropicsoft.invalid> - 2011-05-01 12:52 -0600
  Re: Compound types as functions in latest C++ standard Francis Glassborow<francis.glassborow@btinternet.com> - 2011-05-02 13:10 -0600
    Re: Compound types as functions in latest C++ standard Edward Diener <eldiener@tropicsoft.invalid> - 2011-05-03 19:32 -0600
      Re: Compound types as functions in latest C++ standard  Pete Becker <pete@versatilecoding.com> - 2011-05-04 12:46 -0600
  Re: Compound types as functions in latest C++ standard Daniel Krügler<daniel.kruegler@googlemail.com> - 2011-05-02 13:10 -0600
  Re: Compound types as functions in latest C++ standard Johannes Schaub<schaub.johannes@googlemail.com> - 2011-05-02 13:11 -0600
    Re: Compound types as functions in latest C++ standard Francis Glassborow <francis.glassborow@btinternet.com> - 2011-05-02 16:59 -0600

csiph-web