Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!nih-csl!lhc!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.lang.c Subject: Re: sizeof() confusion Message-ID: <27498@mimsy.umd.edu> Date: 7 Nov 90 04:13:54 GMT References: <9156@latcs1.oz.au> <58808@microsoft.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 24 In article <58808@microsoft.UUCP> dans@microsoft.UUCP (Dan SPALDING) writes: >In C, the base of an array is synonomous with a pointer to an element (the >base element) of that array. Not exactly. A precise definition is: Given an object of type `array N of T' placed in a value context, a C system must produce a value of type `pointer to T' which points to the first (0th) element of that array. `Array' and `pointer' are completely different, but one happens to be converted to the other IN VALUE CONTEXTS. (A `value context' is any place where you need the value of an expression. Thus, given a = b; `b' is in a value context, but `a' is not, because this puts the value of b into a, but says nothing about the value of a.) C happens to have about three contexts which are not value contexts: declarations, left hand side of assignment operators (including `i' in `++i' and `i++'), and following `sizeof'. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 405 2750) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris