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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 1014db,edd83659ff9286d0 X-Google-NewGroupId: yes X-Google-Thread: 103376,1cd9f7e5a0d12003 X-Google-NewGroupId: yes X-Google-Thread: 1094ba,1cd9f7e5a0d12003 X-Google-NewGroupId: yes X-Google-Attributes: gid4516fb5702,gida07f3367d7,gid8d3408f8c3,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.220.230 with SMTP id pz6mr17672333pbc.3.1337651193782; Mon, 21 May 2012 18:46:33 -0700 (PDT) MIME-Version: 1.0 Path: pr3ni23951pbb.0!nntp.google.com!news1.google.com!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: glen herrmannsfeldt Newsgroups: comp.lang.c,comp.lang.ada,comp.lang.fortran Subject: Re: condition true or false? -> (-1 < sizeof("test")) Date: Tue, 22 May 2012 01:45:10 +0000 (UTC) Organization: Aioe.org NNTP Server Message-ID: References: <95634f38f6ee0d116da523fdc2c9f5ca@dizum.com> <00240c6dd26962f50d5c57a933c137ef@dizum.com> NNTP-Posting-Host: H0vc4U5LIRkRHNPyGCs2dA.user.speranza.aioe.org X-Complaints-To: abuse@aioe.org User-Agent: tin/1.9.6-20100522 ("Lochruan") (UNIX) (Linux/2.6.32-5-amd64 (x86_64)) X-Notice: Filtered by postfilter v. 0.8.2 Date: 2012-05-22T01:45:10+00:00 List-Id: In comp.lang.fortran Nomen Nescio wrote: (snip) >> > > Negation of unsigned 1 (which can be written `-1u') is already >> > > defined in C, although there are implementation-defined aspects. >> > > In particular, there are no "overflow issues," usual or otherwise. Note that in C this is applying the unary - operator to the constant 1u. In Fortran, except in rare cases (the DATA statement being one) constants are not signed. (The implentation may apply the unary minus operator before generating the in-memory constant.) I would usually write ~0u instead of -1u, but the result is the same in both cases. In Fortran, one could write NOT(0), with the usual restriction on the bitwise operators on values with the sign bit set. (In addition to the fact that Fortran doesn't require a binary representation for data.) I don't know how ADA treats signed values, or how its bitwise operators work. This is still posted to the ADA group, though. -- glen