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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a9b0810d3106d9b8,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!e8g2000vbz.googlegroups.com!not-for-mail From: "George P." Newsgroups: comp.lang.ada Subject: Fun with C Date: Sat, 16 Apr 2011 10:02:06 -0700 (PDT) Organization: http://groups.google.com Message-ID: <27cf3992-4132-4483-9110-adc7a089cd4a@e8g2000vbz.googlegroups.com> NNTP-Posting-Host: 108.3.157.162 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1302973326 11814 127.0.0.1 (16 Apr 2011 17:02:06 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 16 Apr 2011 17:02:06 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: e8g2000vbz.googlegroups.com; posting-host=108.3.157.162; posting-account=VnNb3AoAAACTpRtCcTrcjmPX7cs92k1Q User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB6.6; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; Tablet PC 2.0; .NET4.0C; .NET4.0E; BRI/1; BRI/2),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:18819 Date: 2011-04-16T10:02:06-07:00 List-Id: 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. Not 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() { unsigned n = 128; int i = -2048; int r; r = i / n; printf("R = %d\n", r); return 0; }