Do objects have type?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Beta What

    #1

    Do objects have type?

    I am seeing lots of posts (and websites like Chris Torek's) that claim
    that objects have type. They are wrong.

    Objects have no type, so everyone please stop spreading misinformation.
    Only values have types (both lvalues and rvalues), not objects.

    Thanks

  • Ben Pfaff

    #2
    Re: Do objects have type?

    "Beta What" <lite.on.beta@g mail.com> writes:
    [color=blue]
    > Objects have no type, so everyone please stop spreading misinformation.[/color]

    From the standard:
    1 object
    region of data storage in the execution environment, the
    contents of which can represent values
    2 NOTE When referenced, an object may be interpreted as
    having a particular type; see 6.3.2.1.
    Most of the time, when we're talking about an object, we're
    interested in its value as a particular type. I don't think it's
    too misleading to refer to this as the type of the object.

    --
    "You call this a *C* question? What the hell are you smoking?" --Kaz

    Comment

    • Lawrence Kirby

      #3
      Re: Do objects have type?

      On Sun, 20 Feb 2005 14:14:33 -0800, Beta What wrote:
      [color=blue]
      > I am seeing lots of posts (and websites like Chris Torek's) that claim
      > that objects have type. They are wrong.[/color]

      If you provided an evidence to back up your rather curious claim we might
      take you seriously.
      [color=blue]
      > Objects have no type, so everyone please stop spreading misinformation.
      > Only values have types (both lvalues and rvalues), not objects.[/color]

      In C90 you might argue that, but how does it help? What problems will
      ascribing a type to an object cause? In C99 6.5p6 objects are given the
      property called an "effective type". This is a type and is a persistent
      property i.e. relates to more than just lvalues in isolation. "Effective
      type" in C99 makes explicit something that was implicit in C90 and
      corrects a problem in C90 relating to malloc'd objects.
      [color=blue]
      > Thanks[/color]

      C doesn't define precedence and associativity rules but they are a useful
      way to describe how the language works. The same is probably true for
      talking about object types, unless you can demonstrate that this
      misrepresents how the language behaves (i.e. would mispredict program
      output).

      Lawrence

      Comment

      Working...