🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9429

sizeof (int) - 1

#9429
From: grayson
Date: Sun, 28 Sep 1986 21:29
13 lines
843 bytes
It is interesting that the expression
	sizeof (int) - 1
is ambiguous in C, for it can be parsed as
	sizeof ((int)(- 1))
or as
	(sizeof(int)) - 1

Think about it!

The unix compiler does it the second way, for when it sees the '-' it
sets the precedence for that character ASSUMING it will be used as a
binary operator.
Technical Details
Message-ID: <102500008@uiucuxc>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbatt!ihnp4!inuxc!pur-ee!uiucdcs!uiucuxc!grayson

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbatt!ihnp4!inuxc!pur-ee!uiucdcs!uiucuxc!grayson
From: grayson@uiucuxc.CSO.UIUC.EDU
Newsgroups: net.lang.c
Subject: sizeof (int) - 1
Message-ID: <102500008@uiucuxc>
Date: Sun, 28-Sep-86 17:29:00 EDT
Article-I.D.: uiucuxc.102500008
Posted: Sun Sep 28 17:29:00 1986
Date-Received: Tue, 30-Sep-86 20:37:46 EDT
Lines: 13
Nf-ID: #N:uiucuxc:102500008:000:319
Nf-From: uiucuxc.CSO.UIUC.EDU!grayson    Sep 28 16:29:00 1986