[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: object-oriented C programming



Sam Couter <sam@topic.com.au> writes:

> The zero overhead rule bugs the crap out of me. How can you call a piece of
> memory an object, if that piece of memory carries no information about what
> it really is? It's not really an object, it's just a piece of memory that
> the compiler knows (at compile time, not run time) to treat like an object.

I think you're confusing two meanings of the word "object".  The
one you're thinking of is taken from the phrase "object-oriented
programming".  The other is that used by the C standard.  From
C89 section 3.14:

	object: A region of data storage in the execution
	environment, the contents of which can represent values.
	Except for bit-fields, objects are composed of contiguous
	sequences of one or more bytes, the number, order, and
	encoding of which are either explicitly specified or
	implementation-defined.  When referenced, an object may
	be interpreted as having a particular type; see 6.2.2.1.

So in C (and, to some extent, C++), an object is just a region of
memory.



Reply to: