`

LONG APIENTRY Esl_CheckCMTClassRecord(struct CMT_Class_Record *ClassRecord, long *ret)
{
   USHORT uResult;
   SHORT retcode;
   uResult = bt3Start(Class.CMT_fd,Class.CMT_data);
   if(uResult == CLASS_RECORDLENGTH )
   {
       memcpy(Class.CMT_data, ClassRecord , CLASS_RECORDLENGTH);
       retcode = bt3FindRel(Class.CMT_fd, Class.CMT_data, FR_EQUAL);    // Read CMT record
       if(retcode > 0)       // read successful
       {
           *ret = 1;
           return(0);
       }
       else
       {
           *ret = 0;
           return(0);
       }
   }
}
I get a warning message - not all control paths return a value. Please help. Thanks

`

That means the function may return without a specific return value. When the condition on line 6 is false, what does the function return? Why not just rearrange it so the function aways return 0 on line 21.

LONG APIENTRY Esl_CheckCMTClassRecord(struct CMT_Class_Record *ClassRecord, long *ret)
{
   USHORT uResult;
   SHORT retcode;
   uResult = bt3Start(Class.CMT_fd,Class.CMT_data);
   if(uResult == CLASS_RECORDLENGTH )
   {
       memcpy(Class.CMT_data, ClassRecord , CLASS_RECORDLENGTH);
       retcode = bt3FindRel(Class.CMT_fd, Class.CMT_data, FR_EQUAL);    // Read CMT record
       *ret = (retcode > 0) ? 1 : 0;       // read successful
   }
   return(0);
}

Edited 4 Years Ago by Ancient Dragon

You know what? You are a GENIUS..Just wondering y did i not get this thought :)

.Just wondering y did i not get this thought

Experience -- the more you program the easier such errors will be to identify and fix.

This question has already been answered. Start a new discussion instead.