`

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

`

Recommended Answers

All 4 Replies

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);
}

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.

Thank you sir. Have a good day :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.