From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a9b0810d3106d9b8 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!z31g2000vbs.googlegroups.com!not-for-mail From: Gerd Newsgroups: comp.lang.ada Subject: Re: Fun with C Date: Sat, 23 Apr 2011 16:07:13 -0700 (PDT) Organization: http://groups.google.com Message-ID: <852b18e3-103c-4f91-8d49-d6bbae149e49@z31g2000vbs.googlegroups.com> References: <27cf3992-4132-4483-9110-adc7a089cd4a@e8g2000vbz.googlegroups.com> NNTP-Posting-Host: 92.230.230.29 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1303600034 13015 127.0.0.1 (23 Apr 2011 23:07:14 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 23 Apr 2011 23:07:14 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: z31g2000vbs.googlegroups.com; posting-host=92.230.230.29; posting-account=XDglRgoAAAAB2wikSHYkYcjK-5hIYGIR User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:19999 Date: 2011-04-23T16:07:13-07:00 List-Id: On 16 Apr., 19:02, "George P." wrote: > Spend few days chasing bug in embedded C project which can drilled > down to this. Consider the following program, and all reasonable men > will expect the result to be negative. =A0Not in C, and it is not a > compiler bug :-( > > And offcorse none of the three comilers I cheched did not bother to > issue a warning at least.. > > #include > > int main() > { > =A0 =A0 =A0unsigned n =3D 128; > =A0 =A0 =A0int i =3D -2048; > =A0 =A0 =A0int r; > > =A0 =A0 =A0r =3D i / n; > > =A0 =A0 =A0printf("R =3D %d\n", r); > > =A0 =A0 =A0return 0; > > > > }- Zitierten Text ausblenden - > > - Zitierten Text anzeigen - Try to run a MISRA checker.