Re: difference

From: E. Robert Tisdale (E.Robert.Tisdale_at_jpl.nasa.gov)
Date: 02/01/04


Date: Sat, 31 Jan 2004 21:31:45 -0800

Joe Wright wrote:

> Hallvard B Furuseth wrote:
>
> [ snip ]
>
>>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.
> Give me an example of an integer constant that you think is an object.

For the definition of the term object,
you should consult an English language dictionary:

        http://www.bartleby.com/61/

Brian W. Kernighan and Dennis M. Ritchie weren't trying
to define an object in the "object oriented" sense.
That is still an *unfinished* task which you should ask about
in the comp.object newsgroup if you are interested.

I think that it is safe to assume that Kernighan and Ritchie
meant both constants and variables here --
constants must be *initialized* after all.

What is clear from the K&R definition is that
objects are *data* objects
in the context of the C programming language.
They occupy (or, at least, could occupy)
some sort of memory storage -- registers, virtual memory, etc.
They were not talking about so-called real world objects.

Whether data objects exist or not may be irrelevant
if there is no way to reference them in the current scope.



Relevant Pages

  • Re: difference
    ... >> I think integer constants are objects, and that what this text refers ... > its interpretation depends on two main attributes: its 'storage class' ... So malloced memory, which is not a variable, is ...
    (comp.lang.c)
  • Re: Larry Wall, on Tcl
    ... This relieves the programmer of one nasty task, namely, ... releasing data objects that are no longer needed. ... variable's value is modified to require a different amount of memory, ...
    (comp.lang.tcl)
  • malloc in embedded systems
    ... RTOS is that it has a weak memory manager. ... The only exception to this is if I pre-define the block ... But I have two different types of data objects, ...
    (comp.arch.embedded)
  • Re: Another question about multidimentional arrays
    ... Ron Francis wrote: ... int arr; ... but the contents (and the memory they occupy) are essentially the same. ...
    (microsoft.public.vc.language)
  • Re: Windows 2000 Groups
    ... environment. ... Is there any limitation? ... Will it occupy any memory for each Group and User assigned ...
    (microsoft.public.win2000.group_policy)