Z
Zach
I am compiling (gcc) with the options: -ansi -pedantic -Wall -W -
Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wpointer-
arith -Wundef -Wshadow -Wbad-function-cast -Wmissing-prototypes -
Wstrict-prototypes -Wmissing-declarations -Wconversion -Winline
I get the following warning messages on my code:
ll9.c: In function 'main':
ll9.c:30: warning: ISO C90 forbids mixed declarations and code
ll9.c: In function 'process_tokens':
ll9.c:116: warning: ISO C90 forbids mixed declarations and code
ll9.c:119: warning: conversion to 'int' from 'size_t' may change the
sign of the result
It seems to be defaulting to C90 but I did not specify "-std=c90".
Anyways I want to remove these warnings so here is the relevant code:
ll9.c:30 char *delims = {" "};
ll9.c:116 int numchars;
ll9.c:119 numchars = strlen(c);
I use line 30 when I call strtok(). What exactly does "mixed
declarations and code" mean? The result of strlen() is an int so the
warning message doesn't make sense to me. How should I change my code
to remove these warnings?
Zach
http://www.fidei.org /* blog */
http://gytha.oggthebase.org /* a python netrek client */
Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wpointer-
arith -Wundef -Wshadow -Wbad-function-cast -Wmissing-prototypes -
Wstrict-prototypes -Wmissing-declarations -Wconversion -Winline
I get the following warning messages on my code:
ll9.c: In function 'main':
ll9.c:30: warning: ISO C90 forbids mixed declarations and code
ll9.c: In function 'process_tokens':
ll9.c:116: warning: ISO C90 forbids mixed declarations and code
ll9.c:119: warning: conversion to 'int' from 'size_t' may change the
sign of the result
It seems to be defaulting to C90 but I did not specify "-std=c90".
Anyways I want to remove these warnings so here is the relevant code:
ll9.c:30 char *delims = {" "};
ll9.c:116 int numchars;
ll9.c:119 numchars = strlen(c);
I use line 30 when I call strtok(). What exactly does "mixed
declarations and code" mean? The result of strlen() is an int so the
warning message doesn't make sense to me. How should I change my code
to remove these warnings?
Zach
http://www.fidei.org /* blog */
http://gytha.oggthebase.org /* a python netrek client */