Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Jan 2001 21:35:15 -0600
From:      Lucas Bergman <lucas@slb.to>
To:        Mike Meyer <mwm@mired.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Printf question
Message-ID:  <20010131213515.A12876@billygoat.slb.to>
In-Reply-To: <14968.51016.322465.80746@guru.mired.org>; from mwm@mired.org on Wed, Jan 31, 2001 at 08:17:44PM -0600
References:  <109394@toto.iv> <14968.51016.322465.80746@guru.mired.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> > What you probably want is the `%llu' specifier instead of `%ld'.
> > Note that `long long' is a _very_ recent addition to the C
> > standard, so proceed with caution if you want your program to be
> > portable.
> 
> The man page doesn't mention ll as a modifier, but talks about q. I
> get the results he wants with %qd, %qu, or %llu - but not %lld.
> -Wall doesn't complain about either one (on -current, anyway).

Hrmm?

  roostor % echo 2 ^ 35 | bc
  34359738368
  roostor % cat foo.c
  #include <stdio.h>

  int
  main(void)
  {
    long long x = 1LL << 35;
    printf("%lld\n", x);
    return 0;
  }
  roostor % gcc -Wall foo.c
  roostor % ./a.out
  34359738368

Lucas


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010131213515.A12876>