Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!sdrc!thor!scjones From: scjones@thor.UUCP (Larry Jones) Newsgroups: comp.lang.c Subject: Re: sizeof() confusion Message-ID: <204@thor.UUCP> Date: 15 Nov 90 19:00:52 GMT References: <9156@latcs1.oz.au> <27432@mimsy.umd.edu> <2665@cirrusl.UUCP> <1990Nov14.154213.27324@cbnewsj.att.com> Organization: SDRC, Cincinnati Lines: 19 In article <1990Nov14.154213.27324@cbnewsj.att.com>, asd@cbnewsj.att.com (Adam S. Denton) writes: > You take sizeof() of an object, not an expression. Sorry, wrong answer. sizeof is an operator just like +, %, or -> -- its operand most certainly IS an expression. sizeof (a * b / c) is every bit as valid as sizeof a (or sizeof(a) for those who think it's some kind of magic function rather than an operator). The key point (which someone else has already mentioned) is that expressions do not undergo any conversions simply because they are expressions; rather, the operands of each operator are converted according to the rules for the particular operator. So, although most operators convert an operand which is an identifier into the corresponding value (i.e. convert an lvalue into an rvalue), sizeof does not. ---- Larry Jones UUCP: uunet!sdrc!thor!scjones SDRC scjones@thor.UUCP 2000 Eastman Dr. BIX: ltl Milford, OH 45150-2789 AT&T: (513) 576-2070 I hope Mom and Dad didn't rent out my room. -- Calvin