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,1cd9f7e5a0d12003 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.223.40 with SMTP id qr8mr11412479pbc.0.1338348128501; Tue, 29 May 2012 20:22:08 -0700 (PDT) Path: pr3ni64523pbb.0!nntp.google.com!news2.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: robin.vowels@gmail.com Newsgroups: comp.lang.ada Subject: Re: condition true or false? -> (-1 < sizeof("test")) Date: Tue, 29 May 2012 20:22:07 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <95634f38f6ee0d116da523fdc2c9f5ca@dizum.com> <00240c6dd26962f50d5c57a933c137ef@dizum.com> NNTP-Posting-Host: 123.2.70.40 Mime-Version: 1.0 X-Trace: posting.google.com 1338348128 8096 127.0.0.1 (30 May 2012 03:22:08 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 30 May 2012 03:22:08 +0000 (UTC) In-Reply-To: <00240c6dd26962f50d5c57a933c137ef@dizum.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=123.2.70.40; posting-account=S_MdrwoAAAD7T2pxG2e393dk6y0tc0Le User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-05-29T20:22:07-07:00 List-Id: On Tuesday, 22 May 2012 01:28:44 UTC+10, Nomen Nescio wrote: > Forwarding this to guys who write code in real languages to see what they > think of this. AFAIK you cannot get something like that past the compiler in > Ada...and you would have to define a type or a subtype to even have an > unsigned int unless you use a modular type IIRC. In FORTRAN I don't remember > an unsigned integer but I haven't used it much since FORTRAN IV. > Basically C gives the coder no help in the example you wrote. It doesn't > make sense to do what you did. It's almost surely an error and it should at > least be flagged as a warning. The fact people calling themselves C > programmers can defend any compiler just letting this go by without at least > a warning amd flaming you and calling you an idiot and a noob really says a > lot about their total lack of discipline and explains the pathetic state of > buffer overflows and race conditions, ad naseum, found in C code.. > Nomen Nescio wrote: > > "BartC" <....@freeuk.com> wrote: > > I don't know any C but it did raise my eyebrows. Looking into this a little: > > #include > > int main() { > > unsigned int a = 4; > > signed int b = -2; > > printf("%u<%d = %d\n", a, b, a > printf("%d<%d = %d\n", 4, b, 4 > printf("%u<%d = %d\n", a, -2, a<-2); > > printf("%d<%d = %d\n", 4, -2, 4<-2); > > } > > Works like yours: > > /bartc > > 4<-2 = 1 > > 4<-2 = 0 > > 4<-2 = 1 > > 4<-2 = 0 In PL/I:-- comparisons: procedure options (main); declare u unsigned fixed binary (31) initial ( 4), s fixed binary (31) initial (-2); put skip list (u, s); put skip list ( u < s, u <= s, u > s, u >= s); end comparisons; Results: 4 -2 '0'B '0'B '1'B '1'B