comp.lang.ada
 help / color / mirror / Atom feed
From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Subject: Re: condition true or false? ->  (-1 < sizeof("test"))
Date: Tue, 22 May 2012 01:45:10 +0000 (UTC)
Date: 2012-05-22T01:45:10+00:00	[thread overview]
Message-ID: <jper36$8t8$1@speranza.aioe.org> (raw)
In-Reply-To: 00240c6dd26962f50d5c57a933c137ef@dizum.com

In comp.lang.fortran Nomen Nescio <nobody@dizum.com> 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



  parent reply	other threads:[~2012-05-22  1:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <95634f38f6ee0d116da523fdc2c9f5ca@dizum.com>
2012-05-21 15:28 ` condition true or false? -> (-1 < sizeof("test")) Nomen Nescio
2012-05-21 15:37   ` Richard Maine
2012-05-21 15:45   ` Adam Beneschan
2012-05-21 17:16     ` Robert A Duff
2012-05-22  1:08   ` Terence
2012-05-22  7:54     ` Les Neilson
2012-05-22 23:19       ` Terence
2012-05-23  7:20         ` Les Neilson
2012-05-22 15:43     ` Fritz Wuehler
2012-05-22  1:45   ` glen herrmannsfeldt [this message]
2012-05-22  6:11     ` Nomen Nescio
2012-05-22  8:00       ` Martin
2012-05-22  9:55       ` BartC
2012-05-22 12:07         ` Dmitry A. Kazakov
2012-05-22 16:25           ` BartC
2012-05-22 17:03             ` Dmitry A. Kazakov
2012-05-22 17:26               ` BartC
2012-05-22 18:18                 ` Dmitry A. Kazakov
2012-05-23  7:26                   ` Terence
2012-05-22 17:56         ` Fritz Wuehler
2012-05-22 10:29     ` Georg Bauhaus
2012-05-30  3:22   ` robin.vowels
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox