[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: variable semantics vs value semantics (was Re: Interfacing luawith C)
- From: "Peter Hill" <corwin@...>
- Date: Sun, 19 Jan 2003 14:00:00 +0800
> I disagree. In C "lvalues" (ie, variables) have a type but *so do*
> "rvalues" (ie, objects). Though rvalues do have a short lifetime (such
> that they may only exist on the stack) they are objects independent from
> variables, carrying their own type.
> And exactly where do they carry it? How do you figure out what the type of
> an arbitrary C value is? They "carry" a type during compilation. But that
> is not the same thing.
At runtime the type (for variables _and_ objects) is stored in the code that
accesses the data rather than in the object/variable itself.
And stack objects carry exactly the _same_ amount of type information that
variables do, so if you say that variables (lvalues) are typed then you must
also say that objects (rvalues) are typed as well.