Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site root44.UUCP Path: utzoo!watmath!clyde!burl!mgnetp!ihnp4!houxm!houxz!vax135!ukc!hirst1!root44!addw From: addw@root44.UUCP (Alain Williams) Newsgroups: net.lang.c Subject: Re: side effects inside sizeof Message-ID: <4671@root44.UUCP> Date: Wed, 27-Jun-84 22:30:14 EDT Article-I.D.: root44.4671 Posted: Wed Jun 27 22:30:14 1984 Date-Received: Sat, 16-Jun-84 03:47:37 EDT Organization: Root Computers Ltd. Lines: 22 <<<<>>>> Henry Spencer @ U of Toronto Zoology produced the following abomination: main(){ int x = 1; printf("%u\n", sizeof(x++)); printf("%d\n", x); } He grumbles that the second printf produces a result of "1", & comments: >> But nowhere in K&R is there anything that would >> permit this wanton disregard of side effects, But there is "nowhere in K&R is there anything that would" suggest that the compilers are to be proof against all idiots. If one tries hard enough it is possible to find pathological cases that break almost anything. Indulging in such exercises is something that I enjoyed as an undergraduate, but have since grown out of. I now try & USE the tools that I have. Alain Williams, Root Computers Ltd, London. {ENGLAND}!hirst1!root44!addw edai!root44!rootis!addw ukc!root44!addw