Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!think.com!barmar From: barmar@think.com (Barry Margolin) Newsgroups: comp.lang.c Subject: Re: is (int (*)())NULL legal when NULL is (void *)0? Message-ID: <1990Nov15.204858.20696@Think.COM> Date: 15 Nov 90 20:48:58 GMT References: <14457@smoke.brl.mil> <13799@crdgw1.crd.ge.com> <14463@smoke.brl.mil> Sender: news@Think.COM Organization: Thinking Machines Corporation, Cambridge MA, USA Lines: 18 In article <14463@smoke.brl.mil> gwyn@smoke.brl.mil (Doug Gwyn) writes: >A null pointer constant can be safely compared to a pointer to function, >and it can be safely assigned to a pointer to function modifiable lvalue, >but that's it. Casting a null pointer constant to pointer to function is >not permitted in a strictly conforming program. I thought that the semantics of casting were equivalent to that of assignment to an object of the given type. So how can an assignment be valid but the corresponding cast be invalid? Or is this equivalence an old rule of thumb that isn't precisely correct? Are there other examples of assignments that don't have corresponding casts or vice versa? -- Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar