Re: difference

From: nospam (h.b.furuseth(nospam)_at_usit.uio(nospam).no)
Date: 02/01/04


Date: 01 Feb 2004 05:33:33 +0100

Joe Wright wrote:
>Hallvard B Furuseth wrote:
>> I think integer constants are objects, and that what this text refers
>> to is lvalues like *p where p points to freed memory. That freed
>> memory is no longer an object.
>>
> From K&R2 A4 p195
> "An object, sometimes called a variable, is a location in storage, and
> its interpretation depends on two main attributes: its 'storage class'
> and its 'type'."..
>
> That doesn't sound like a constant to me. I must have missed something
> important earlier.

What you missed is that C is defined by the C standard, not by K&R2.
The sentence you quoted illustrates why: It is wrong. It says that all
objects are variables. So malloced memory, which is not a variable, is
not an object.

> Give me an example of an integer constant that you
> think is an object. Please.

1

-- 
Hallvard


Relevant Pages

  • Re: difference
    ... >>I think integer constants are objects, ... They occupy ... some sort of memory storage -- registers, virtual memory, etc. ... Whether data objects exist or not may be irrelevant ...
    (comp.lang.c)
  • Re: difference
    ... > I think integer constants are objects, and that what this text refers ... > to is lvalues like *p where p points to freed memory. ... its interpretation depends on two main attributes: its 'storage class' ...
    (comp.lang.c)