Jump to content

Compile warnings


king2

Recommended Posts

JFYI:

gdisp.c, assign sedge, eedge, startTen, endTan: Warning[Pa093]: implicit conversion from floating point to integer. (float) needs to be added before rvalue.

gtimer.c: THREAD_RETURN(0) after while(1) raises Warning[Pe111]: statement is unreachable

gwin.c: _gwinDrawEnd(gh) after return in gwinGetPixelColor - same warning

 

Link to comment
Share on other sites

  • 2 weeks later...

The implicit conversion warning is just that, a warning. It is perfectly valid C and perscribed behaviour for the C language. That the compiler is warning is being overly cautious and should be ignored. The reality is that the code is perfectly fine and is 100% valid C.

The gtimer.c warning is a situation of dammed if you do and dammed if you don't. As gtimer is run as a thread process most operating systems require a return value for the function. So even though the code is unreachable most compilers will complain if you don't have a suitable return statement. On the other hand most compilers don't bother to complain about unreachable code in that situation unless the warning levels are set too high. So, in either case you will get a warning message from the compiler. You are just less likely to get a warning the way we have coded it.

Without checking the code I suspect the gwin.c situation is the same.

In summary, the code is fine. If the warnings bother you then turn down the warning level on the compiler.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...