[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Unary Minus for Constants
- From: Dave Dodge <dododge@...>
- Date: Thu, 9 Aug 2007 15:19:41 -0400
On Thu, Aug 09, 2007 at 09:41:41AM -0300, Roberto Ierusalimschy wrote:
> > Instead, it passes everything AFTER the "-" and then does the
> > unary minus as defined for the default arithmetic type.
> Most languages do this.
For example the C language itself has no support for negative integer
constants. When you say "-1" it's really a constant expression
involving unary negation of an integer constant. This has an
interesting corner case when you want to specify the minimal value for
a signed integer type, because in most implementations the negative
range is larger than the positive range and the implementation's
header files have to play tricks like this:
#define LLONG_MIN (-LLONG_MAX - 1LL)