Re: Long long int's and sprintf

From: Daniel A. Koepke (dkoepke@circlemud.org)
Date: 06/16/01


On Sat, 16 Jun 2001, Cris Jacobin wrote:

> Actually I receive no warnings using (1ULL << 36) and lld. However,
> now that you point it out it becomes quite obvious.  Thanks for the
> help.

That's really very bizarre.  First, AFAIK, (1ULL << 36) should be just as
valid as what I recommended.  The longer form that I used is, I thought,
out of personal preference (something I probably should've noted in the
previous message, sorry) and entirely unnecessary.  Second, your compiler
should at least warn about doing

  sprintf(buf, "... %lld ...", ..., (1ULL << 36), ...);

since you're providing an unsigned value for a signed conversion.  What
compiler are you using?  Are all the warnings turned on?


--
Daniel A. Koepke (dak), dkoepke@circlemud.org
Caveat emptor: I say what I mean and mean what I say.  Listen well.
Caveat venditor: Say what you mean, mean what you say.  Say it well.

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/05/01 PST