T
Ton 't Lam
Please, consider the following minimal example code:
# more f.l
%option noyywrap
%{
#include <string.h>
%}
%%
[0-9]+ return( strdup (yytext));
%%
# more main.c
#include <stdio.h>
main()
{
printf( "%s\n", yylex());
}
# flex f.l
# cc -o prog main.c lex.yy.c
f.l: In function ‘yylex’:
f.l:9: warning: return makes integer from pointer without a cast
The program 'main' works correctly.
gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)
flex 2.5.33
If I cast with (char *) on several places, I see no improvement.
Googling didn't lead me to a solution either.
How can I corect the code, so I don't have this warning?
Many thanks,
Ton
# more f.l
%option noyywrap
%{
#include <string.h>
%}
%%
[0-9]+ return( strdup (yytext));
%%
# more main.c
#include <stdio.h>
main()
{
printf( "%s\n", yylex());
}
# flex f.l
# cc -o prog main.c lex.yy.c
f.l: In function ‘yylex’:
f.l:9: warning: return makes integer from pointer without a cast
The program 'main' works correctly.
gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)
flex 2.5.33
If I cast with (char *) on several places, I see no improvement.
Googling didn't lead me to a solution either.
How can I corect the code, so I don't have this warning?
Many thanks,
Ton