Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpcc01!hpcuhb!hpcllla!hpcllca!walter From: walter@hpcllca.HP.COM (Walter Murray) Newsgroups: comp.std.c Subject: Re: Optional vs. required diagnostics Message-ID: <16490024@hpcllca.HP.COM> Date: 25 Jul 90 16:49:13 GMT References: <17144@haddock.ima.isc.com> Organization: Hewlett Packard Calif. Language Lab Lines: 27 Karl Heuer asks: > Must the following code fragments generate a diagnostic? > /* [0] */ double *p; int x; p = &x; > /* [1] */ void f(double *p); int x; f(&x); I believe both fragments require diagnostics. Maybe I'm missing something here, but it seems to me the key section of the standard is 3.3.16.1, Simple Assignment. It contains a single constraint, stating that in a simple assignment one of five conditions must hold. Your fragment [0] contains a simple assignment for which none of those conditions hold, so it violates the constraint and must be diagnosed by a conforming compiler. Anyone who claims that a diagnostic is not required should say which of the five conditions does hold. Likewise, fragment [1] violates a constraint in 3.3.2.2, because the assignment would be illegal. It's 3.3.16.1 that tells us the assignment is illegal. As I see it, the clause in 3.3.4 beginning, "Conversions that involve pointers ..." could be deleted without changing the standard. It is only serving to introduce the following four paragraphs. Walter Murray ----------