[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUDs
. -> [Folder]  General
. . -> [Subject]  int vs long int in warning

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

int vs long int in warning

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Baron Sengir   USA  (29 posts)  [Biography] bio
Date Thu 12 Nov 2009 12:43 AM (UTC)  quote  ]
Message
While reconfiguring how the score sheet looks for players in the MUD, I've come across a warning when compiling that I'm curious about. (normally I try to fix all warnings out of principal)

act_info.c:1629: warning: format '%9d' expects type 'int', but argument 3 has type 'long int'

The offending line is below for reference:
sprintf (buf, "{W | / | Gold: %9d | / |{x\n\r", ch->gold);

My question then becomes this, would it be ok to leave it as is? If this was just a number off of a report it would be fine, but I have the ascii lined up with 9 spaces blocked off to keep everything in line. Or would it be better for me to go through and change ch->gold to int instead of long int? Any thoughts would be appreciated.

Baron Sengir
aka Co-Admin/Head Coder of "Dark Ages: Legendary Secrets"
Currently in R&D Phase
[Go to top] top

Posted by Zeno   USA  (2,868 posts)  [Biography] bio   Moderator
Date Reply #1 on Thu 12 Nov 2009 01:08 AM (UTC)  quote  ]
Message
Have you tried %9ld?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Baron Sengir   USA  (29 posts)  [Biography] bio
Date Reply #2 on Thu 12 Nov 2009 01:33 AM (UTC)  quote  ]
Message
That did the trick wonderfully. I was not aware of the existence of that (or if I did long ago, it surely had slipped from my memory). Thank you much Zeno!

Baron Sengir
aka Co-Admin/Head Coder of "Dark Ages: Legendary Secrets"
Currently in R&D Phase
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


1,643 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]