Author Topic: build warning in rev 8296 in sqvm.cpp  (Read 4201 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5927
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
build warning in rev 8296 in sqvm.cpp
« on: August 31, 2012, 03:40:56 am »
I see such warning:
Quote
||=== Code::Blocks wx2.8.x, Squirrel ===|
sdk\scripting\squirrel\sqvm.cpp||In member function 'bool SQVM::Execute(SQObjectPtr&, SQInteger, SQInteger, SQInteger, SQObjectPtr&, SQBool, SQVM::ExecutionType)':|
sdk\scripting\squirrel\sqvm.cpp|1062|warning: control reaches end of non-void function [-Wreturn-type]|

Code
bool SQVM::Execute(SQObjectPtr &closure, SQInteger target, SQInteger nargs, SQInteger stackbase,SQObjectPtr &outres, SQBool raiseerror,ExecutionType et)
{
....

    assert(0);
}
So, add a “return true"?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: build warning in rev 8296 in sqvm.cpp
« Reply #1 on: August 31, 2012, 06:21:54 am »
Code
bool SQVM::Execute(SQObjectPtr &closure, SQInteger target, SQInteger nargs, SQInteger stackbase,SQObjectPtr &outres, SQBool raiseerror,ExecutionType et)
{
....

    assert(0);
}
So, add a “return true"?
You can, but if the assert raises it doesn't really matter as the application is aborted before.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5927
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: build warning in rev 8296 in sqvm.cpp
« Reply #2 on: August 31, 2012, 06:54:17 am »
Done in rev 8297.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.