----- Original Message -----
From: "Its Me Christian" <cd_fl@HOTMAIL.COM>
To: <CIRCLE@post.queensu.ca>
Sent: Thursday, June 28, 2001 12:04 AM
Subject: [CIRCLE] Max level
[snip]
> \src\tedit.c(85) : warning C4305: 'initializing' : truncation from 'const
> int ' to 'char '
>
> tedit...
> fields[] = {
> /* edit the lvls to your own needs */
> <<<<< Here down i get the warnings (line below is line 85)>>>>>
>
> { "credits", LVL_IMPL, &credits, 2400, CREDITS_FILE},
> { "news", LVL_GRGOD, &news, 8192, NEWS_FILE},
> { "motd", LVL_GRGOD, &motd, 2400, MOTD_FILE},
> { "imotd", LVL_IMPL, &imotd, 2400, IMOTD_FILE},
> { "help", LVL_GRGOD, &help, 2400, HELP_PAGE_FILE},
> { "info", LVL_GRGOD, &info, 8192, INFO_FILE},
> { "background", LVL_IMPL, &background, 8192, BACKGROUND_FILE},
> { "handbook", LVL_IMPL, &handbook, 8192, HANDBOOK_FILE},
> { "policies", LVL_IMPL, &policies, 8192, POLICIES_FILE},
> { "\n", 0, NULL, 0, NULL }
[snip]
From tedit.c on my machine.
struct {
char *cmd;
char level;
const char **buffer;
int size;
char *filename;
} fields[] = {
Note that level is a variable of type 'char'.
Now, from the error, that you're truncating a 'const int' to a 'char', I'd
assume that instead of using
#define LVL_IMPL (number)
...you've changed your source to:
const int LVL_IMPL = (number);
...where (number) is whatever level you're setting it to. So the problem
is, you're truncating a const int to a char. Which it's warning you
(wisely), because a (signed) char will only hold -128 to 127, so when you
exceed that, you go down in flames.
Change your LVL_IMPL declaration back to how stock is, or change "char
level;" to "int level;"--it might warn that you're ignoring the "const", but
that shouldn't be an issue.
-k.
(feeling helpful tonight, I guess)
--
+---------------------------------------------------------------+
| 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