Help - Cast converts default int return type

What does the warning message 724 "Cast converts default int return type to." tell me.

I am new to C. (used it some in college). We are migrating our c-code to 10.2.0.3.0. The programs compiled clean. However there were several warning messages that kick out. The most prominent warning is:

Pro*C/C++: Release 10.2.0.3.0 - Production on Mon Apr 23 09:47:08 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
System default option values taken from: /u21/oracle/product/102030_64/precomp/g
cc -DCACS_ORA -O -g -DDEBUG +DA2.0W +DS2.0 -DSS_64BIT_SERVER -I. -Ic
cc: "drmio.pc", line 86: warning 724: Cast converts default int return type to .
cc: "drmio.pc", line 825: warning 724: Cast converts default int return type to.

I believe it is a 32 bit -> 64 bit issue. (pointers are now 64 bits)

Any assistance that can be provided would be greatly appreciated. Thank you

Below is a snipit of line 86 with declarations:

#include <stdio.h>

#include "drm.h"
/VA-28 - 07/25/01 - Begin/
/-- modify for the cache --/
#include "drm_mods.h"
/VA-28 - 07/25/01 - End/

#define IsItNullColumn(column_name) (column_name == -1)
#define AssignNullStr(char_array) strcpy(char_array,"")

#define SQL_NO_ERROR 0
#define SQL_NOT_FOUND +100

EXEC SQL INCLUDE SQLCA ;

TEMPLATE_ELEMENT *gstr_db_element = NULL ;
OLD_DOC_ELEMENT *gstr_olddoc_element = NULL ;
int gai_element_array[SIZE\_MAX\_NO\_OF_ELEMENTS] ;

int gi_max_database_elements = 0 ;
int gi_max_olddoc_elements = 0 ;

extern int gi_max_elements ;
int gi_max_elements ;

char gac_default_unix_date_format[] = "%D %T" ;

int GetElementInfo_i(int ar_ai_element_id[] )
{
/VA-28 - 07/25/01 - Begin/
/*--
EXEC SQL BEGIN DECLARE SECTION ;
int li_id ;
int li_retrieval_type ;
int li_criteria_id ;
char lac_table_name[SIZE\_TBL_NAME] ;
EXEC SQL VAR lac_table_name is STRING(SIZE_TBL_NAME);
char lac_fld_name[SIZE\_FLD_NAME] ;
EXEC SQL VAR lac_fld_name is STRING(SIZE_FLD_NAME);
char lac_fun_name[SIZE\_FUNC_NAME] ;
EXEC SQL VAR lac_fun_name is STRING(SIZE_FUNC_NAME);
int li_format_fun_id ;
char lac_word_format[SIZE_FORMAT] ;
EXEC SQL VAR lac_word_format is STRING(SIZE_FORMAT);

		short	lshort\_criteria\_null_ind,
				lshort\_tablename\_null_ind,
				lshort\_fldname\_null_ind,
				lshort\_funname\_null_ind,
				lshort\_formatfun\_null_ind,
				lshort\_wordformat\_null_ind ;

--*/
/*--	EXEC  SQL END   DECLARE SECTION ;--*/
/*VA-28 - 07/25/01 - End*/

int count = 0 ;
/*VA-28 - 07/25/01 - Begin*/
int i = 0;
int li_id;

/*-- [ARCS Mods] Debug Messages --*/
DebugPrintf\("In GetElementInfo_i\(\)\\n"\);
DebugPrintf\("gi\_max_elements = %d\\n", gi\_max_elements\);
DebugPrintf\("g\_max\_cache\_db_elements = %d\\n", g\_max\_cache\_db_elements\);
/*VA-28 - 07/25/01 - End*/

if \( gi\_max_elements &lt;= 0 \)
\{
	return\(-1\) ;
\}
gi\_max\_database_elements = gi\_max_elements ;

gstr\_db_element = \(TEMPLATE_ELEMENT *\)DoMemoryAlloc\_pv\(gi\_max_elements * sizeof\(TEMPLATE_ELEMENT\)\) ; \(line 86\)

if \( gstr\_db_element == \(TEMPLATE_ELEMENT *\)NULL \)
\{
	return\(-1\) ;
\}

Very often the line number is where the error was noticed, not where it occurred. I believe the message is complaining about the return(-1). That error message looks garbled, but probably I would check for a mismatch bewteen the declaracation of the function and what you are returning.

You don't show what type the function is supposed to be returning. What type is the "return (-1);" supposed to be returning. If it's not some kind of int or float you are in trouble.

eg

void *func(void)
{
return -1;
}

is an error, where as

int func(void)
{
return -1;
}

is not.

Thank for the reply. I checked and the function returns int. I've also included the code from the building of the script. If you could look at it one more time, I'd appreciate it.

Per your suggestion, I noticed that a function in many of my bad calls returns a void.

DoMemoryAlloc_pv (line 86) is defined with a void pointer (see below). The documentation tells me that in C++ I need to cast it. Can I still use a void in this definition? Do I have to determine the type before I allocate memory?
Please help.

void *DoMemoryAlloc_pv(size_t memsize)
{
void * vp_tmp_memory_area ;

if \(!\(vp\_tmp\_memory_area = \(void *\)malloc\(memsize\)\)\)
\{
	LogPrintf\("Unable to allocate memory \(requested memory size  = %d bytes\)\\n", memsize\) ;
	return\(\(void *\)NULL\) ;
\}
return\(\(void *\)vp\_tmp\_memory_area\) ;

}

You can use pointer to void as the value returned from a function. But you must cast it to use it. You can allocate a chunk of memory not knowing what will go there.

I can't really comment on the expanded code you added. I don't know what "EXEC SQL" is supposed to do. I'm guessing you have some database preprocessor or something. Also I don't have your include files. Just glancing at the code, I do not see a reason for a complaint about the returns.

Thank you for all your help. I discovered that if I simply declare the definition of the function that is causing the error in the beginning of the code, the errors go away. I don't think the compiler was seeing the definition of the embedded function.

extern void *DoMemoryAlloc_pv(size_t) ;