Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: Some possible deficiencies in dpANS (or whatever its called) Message-ID: <7134@brl-smoke.ARPA> Date: 19 Jan 88 15:24:48 GMT References: <4755@tut.cis.ohio-state.edu> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 44 Keywords: none In article <4755@tut.cis.ohio-state.edu> lvc@tut.cis.ohio-state.edu (Lawrence V. Cipriani) writes: >it looks like the following are valid *statements*: > i; > j << 2; > k == 0; > "hello world\n"; Yes. >I believe this is a deficiency. These statements have no effect ... Such statements may be produced by macro expansion. There doesn't seem to be any reason to outlaw them. In fact, the first three all "touch" a variable and therefore do have a practical effect, sometimes. >and in fact lint flags them. This is probably the best way to protect against actual errors like this. >2) In the definition of the sizeof operator, the sentence >"When applied to an operand that has array type, the result is >the total number of bytes in the array". Perhaps I didn't look >in the right place; I can't find a place where the total number >of bytes in the array is defined. 3.1.2.5: An \fIarray type\fP describes a contiguously allocated set of member objects all of which have the same type, called the \fIelement type\fP. ... So there's the first clue: an array consists of "contiguously allocated" member elements. 3.3.3.4: Another use of the \f(CWsizeof\fP operator is to compute the number of members in an array: .DS I .ft CW sizeof array / sizeof array[0] .ft .DE There's the final clue: sizeof array = number_of_members times sizeof one member.