What is the postfix for min long value?

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Oct 6 08:39:35 PDT 2015


On 10/06/2015 08:16 AM, tcak wrote:
 > While writing max ulong value, I added the "u" postfix.

Better to use U to be consistent with L (see below).

 > But when I try to print out minimum value of long, compiler says
 > Error: signed integer overflow
 >
 > writeln( -9_223_372_036_854_775_808 );

I would expect the following to work:

     writeln( -9_223_372_036_854_775_808L);

But it doesn't compile:

   Error: signed integer overflow

It looks like a compiler bug to me. If so, a very embarrassing one. :)

(You can use UL and LU as well.)

 > Do I need to put a postfix for that number? I checked documentation by
 > searching "dlang integer" etc, but couldn't have found any
 > information/anything about postfix at all.

They go by "suffix". The officital documentation:

   http://dlang.org/lex.html#integerliteral

My short mention of them start at the section "The L suffix":

   http://ddili.org/ders/d.en/literals.html#ix_literals.literal

(They were missing in my index section. Adding now...)

Ali



More information about the Digitalmars-d-learn mailing list