Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!wuarchive!udel!princeton!cs!cs.Princeton.EDU!drh From: drh@cs.Princeton.EDU (Dave Hanson) Newsgroups: comp.std.c Subject: constant expressions Message-ID: <1958@rossignol.Princeton.EDU> Date: 17 Aug 90 12:23:24 GMT Sender: news@cs.Princeton.EDU Organization: Dept. of Computer Science, Princeton University Lines: 19 >> char * a; >> a = 1-1; >the assignment of an integer to a pointer is legal >iff the integer is a null pointer constant, >which by sec. 3.2.2.3 must be an integral constant >expression with the value 0. >so the 1-1 in the expressions above must >be computed at compile time to determine legality. Yes, because 3.3.16.1 has it in a constraints section. So it appears that, where the standard says that the compiler CAN compute constants at translation time, the standard almost lies. The compiler MUST compute constants at translation time. This is unfortunate (because a cross-compiler will become difficult). (It's not quite a lie because the standard's words don't contradict each other, only the implications do. Why say "can" when it means "must"?) -- Norman Diamond diamond@tkou02.enet.dec.com