Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!dkuug!freja.diku.dk!rimfaxe.diku.dk!thorinn From: thorinn@rimfaxe.diku.dk (Lars Henrik Mathiesen) Newsgroups: comp.lang.c Subject: Re: Function pointer casts in ANSI C Message-ID: <1990Dec4.135229.7039@diku.dk> Date: 4 Dec 90 13:52:29 GMT References: <1990Nov29.110114.21565@diku.dk> <14610@smoke.brl.mil> <1990Nov30.010812.27070@nntp-server.caltech.edu> Sender: news@diku.dk (The Netnews System) Organization: Department Of Computer Science, University Of Copenhagen Lines: 26 thorinn@skinfaxe.diku.dk (Lars Henrik Mathiesen) writes: >My question is: Can a conforming compiler generate a warning for casts >(and arguments) that will ``go wrong'' but not for those that work? gwyn@smoke.brl.mil (Doug Gwyn) writes: >A conforming implementation must produce at least one diagnostic for each >translation unit that violates a syntax rule or constraint. Diagnostics >may be produced under other circumstances, but are not required. Doug's analysis applies to the "(and arguments)" in the question. For casts, 3.3.4 (Cast operators) Semantics tells us that behaviour is undefined because the function types are incompatible, but no diagnostic is required. manning@nntp-server.caltech.edu (Evan Marshall Manning) writes: >My favorite lint (from Gimpel) would call those that work "non-portable", >and issue a more serious warning/error message for those that not will >work. Is this lint architecture- and compiler-specific (or configurable) since it knows what works? Or does it just guess based on two's complement, byte addressable, 32-bit int and pointer machines? -- Lars Mathiesen, DIKU, U of Copenhagen, Denmark [uunet!]mcsun!diku!thorinn Institute of Datalogy -- we're scientists, not engineers. thorinn@diku.dk Brought to you by Super Global Mega Corp .com