R
Roman Mashak
Hello, All!
Assume I wrote function like:
/* authenticate client */
int cli_auth(char *user_id, char *user_pass)
{
MYSQL conn;
if ( db_init(&conn) == 0 ) {
if ( db_search(&conn, user_id, user_pass) != AUTH_PASS ) return
AUTH_FAIL;
}
else return FAIL;
}
....
if ( cli_auth(msg_id, msg_passwd) == AUTH_FAIL ) {
...
}
Compiling it with gcc, I get the warnings:
#gcc -g -Wall -o server server.c
server.c: In function `cli_auth':
server.c:33: warning: control reaches end of non-void function
Seems like standard requires non-void function to return something, in my
case function always returns some value. Then, why do I get warning?
With best regards, Roman Mashak. E-mail: (e-mail address removed)
Assume I wrote function like:
/* authenticate client */
int cli_auth(char *user_id, char *user_pass)
{
MYSQL conn;
if ( db_init(&conn) == 0 ) {
if ( db_search(&conn, user_id, user_pass) != AUTH_PASS ) return
AUTH_FAIL;
}
else return FAIL;
}
....
if ( cli_auth(msg_id, msg_passwd) == AUTH_FAIL ) {
...
}
Compiling it with gcc, I get the warnings:
#gcc -g -Wall -o server server.c
server.c: In function `cli_auth':
server.c:33: warning: control reaches end of non-void function
Seems like standard requires non-void function to return something, in my
case function always returns some value. Then, why do I get warning?
With best regards, Roman Mashak. E-mail: (e-mail address removed)