Thread overview | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
April 18, 2003 printf | ||||
---|---|---|---|---|
| ||||
Ok, looks like printf is in fact in the stdio module. It's also in object. I guess this isn't a problem. However I seem unable to get printf to print out long (64-bit) ints, either in decimal or in hex. printf("big hex num = %lx\n",~0ul); printf("big dec num = %lu\n",~0ul); Am I being an idiot? Sean |
April 18, 2003 Re: printf | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean L. Palmer | Sean L. Palmer wrote:
> Ok, looks like printf is in fact in the stdio module. It's also in object.
> I guess this isn't a problem.
>
> However I seem unable to get printf to print out long (64-bit) ints, either
> in decimal or in hex.
>
> printf("big hex num = %lx\n",~0ul);
> printf("big dec num = %lu\n",~0ul);
>
> Am I being an idiot?
>
> Sean
>
>
Tried it as above on my system and worked fine for me. Used DMD 0.61.
-John
|
April 18, 2003 Re: printf | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean L. Palmer |
"Sean L. Palmer" wrote:
>
> Ok, looks like printf is in fact in the stdio module. It's also in object. I guess this isn't a problem.
>
> However I seem unable to get printf to print out long (64-bit) ints, either
> in decimal or in hex.
>
> printf("big hex num = %lx\n",~0ul);
> printf("big dec num = %lu\n",~0ul);
>
I use
printf("TimerCount Start=%lld\n",t1);
--
Helmut Leitner leitner@hls.via.at Graz, Austria www.hls-software.com
|
April 18, 2003 Re: printf | ||||
---|---|---|---|---|
| ||||
Posted in reply to John Reimer | "John Reimer" <jjreimer@telus.net> wrote in message news:b7ogrh$23g1$2@digitaldaemon.com... > Sean L. Palmer wrote: > > > However I seem unable to get printf to print out long (64-bit) ints, either > > in decimal or in hex. > > > > printf("big hex num = %lx\n",~0ul); > > printf("big dec num = %lu\n",~0ul); > > Tried it as above on my system and worked fine for me. Used DMD 0.61. John, you mean you actually saw: big hex num = ffffffffffffffff big dec num = 18446744073709551615 Strange. I think, as Helmut wrote, one, indeed, needs to use "ll" instead of "l". (I do use 0.61) Cheers, Sz. |
April 18, 2003 Re: printf | ||||
---|---|---|---|---|
| ||||
Posted in reply to Luna Kid | > > > However I seem unable to get printf to print out long (64-bit) ints,
> either
> > > in decimal or in hex.
> > >
> > > printf("big hex num = %lx\n",~0ul);
> > > printf("big dec num = %lu\n",~0ul);
> >
> > Tried it as above on my system and worked fine for me. Used DMD 0.61.
>
> John, you mean you actually saw:
>
> big hex num = ffffffffffffffff
> big dec num = 18446744073709551615
>
> Strange. I think, as Helmut wrote, one, indeed, needs
> to use "ll" instead of "l". (I do use 0.61)
Which seems wrong, anyhow, I mean.
Sz.
|
April 18, 2003 Re: printf | ||||
---|---|---|---|---|
| ||||
Posted in reply to Luna Kid | Luna Kid wrote:
> "John Reimer" <jjreimer@telus.net> wrote in message
> news:b7ogrh$23g1$2@digitaldaemon.com...
>
>>Sean L. Palmer wrote:
>>
>>
>>>However I seem unable to get printf to print out long (64-bit) ints,
>
> either
>
>>>in decimal or in hex.
>>>
>>>printf("big hex num = %lx\n",~0ul);
>>>printf("big dec num = %lu\n",~0ul);
>>
>>Tried it as above on my system and worked fine for me. Used DMD 0.61.
>
>
> John, you mean you actually saw:
>
> big hex num = ffffffffffffffff
> big dec num = 18446744073709551615
>
> Strange. I think, as Helmut wrote, one, indeed, needs
> to use "ll" instead of "l". (I do use 0.61)
>
> Cheers,
> Sz.
>
>
oops, you're right. ha ha. Stupid me. :-P
I guess I did only see the 32 bit version after all.
Thanks,
- John
|
April 18, 2003 Re: printf | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean L. Palmer | %lld "Sean L. Palmer" <palmer.sean@verizon.net> wrote in message news:b7odha$21hh$1@digitaldaemon.com... > Ok, looks like printf is in fact in the stdio module. It's also in object. > I guess this isn't a problem. > > However I seem unable to get printf to print out long (64-bit) ints, either > in decimal or in hex. > > printf("big hex num = %lx\n",~0ul); > printf("big dec num = %lu\n",~0ul); > > Am I being an idiot? > > Sean > > |
April 18, 2003 Re: printf | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean L. Palmer | %lld is the correct one Actually %ld will work, but truncate, and if you have multiple formatted expansions within a single block it'll be nasty. "Sean L. Palmer" <palmer.sean@verizon.net> wrote in message news:b7odha$21hh$1@digitaldaemon.com... > Ok, looks like printf is in fact in the stdio module. It's also in object. > I guess this isn't a problem. > > However I seem unable to get printf to print out long (64-bit) ints, either > in decimal or in hex. > > printf("big hex num = %lx\n",~0ul); > printf("big dec num = %lu\n",~0ul); > > Am I being an idiot? > > Sean > > |
April 18, 2003 Re: printf | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean L. Palmer | %lld is the correct one Actually %ld will work, but truncate, and if you have multiple formatted expansions within a single block it'll be nasty. "Sean L. Palmer" <palmer.sean@verizon.net> wrote in message news:b7odha$21hh$1@digitaldaemon.com... > Ok, looks like printf is in fact in the stdio module. It's also in object. > I guess this isn't a problem. > > However I seem unable to get printf to print out long (64-bit) ints, either > in decimal or in hex. > > printf("big hex num = %lx\n",~0ul); > printf("big dec num = %lu\n",~0ul); > > Am I being an idiot? > > Sean > > |
April 18, 2003 Re: printf | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean L. Palmer | Write printf("big hex num = %llx\n",~0ul); instead (notice double 'l': %llx) Since it works in DMC, I think it works in D. "Sean L. Palmer" <palmer.sean@verizon.net> wrote in message news:b7odha$21hh$1@digitaldaemon.com... > Ok, looks like printf is in fact in the stdio module. It's also in object. > I guess this isn't a problem. > > However I seem unable to get printf to print out long (64-bit) ints, either > in decimal or in hex. > > printf("big hex num = %lx\n",~0ul); > printf("big dec num = %lu\n",~0ul); > > Am I being an idiot? > > Sean > > |
Copyright © 1999-2021 by the D Language Foundation