This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Disable Keil warning

Hello,

I've been trying to remove a compiling warning (C182) without success.

Can anyone point me in the right direction? Is there a directive available to disable a specific warning ?

Thank you.

8051 architecture, c51 compiler

Parents
  • From your answer, we know that you don't understand this issue. So maybe you really should spend some time to debate this issue.

    If the two pointers really are compatible, then a type cast in C wouldn't add any extra code or consume clock cycles. It would be a pure syntactic construct to tell the compiler "yes, I know the pointer is type A but but is compatible enough that I want to use it as if it was type B". The only conversion happening would be of the meta information kept within the symbol tables of the C compiler while it was busy generating the code.

    It does not cost time to convert an int* pointer into a char* pointer - except the few seconds it takes to tell the compiler that you really want to use the int* pointer as if it was a char* pointer.

    But the next issue is that actual pointer types can matter a lot depending on architecture and used compiler. Such as size of pointer (near, far, huge), or a "based" pointer that might operate relative to a specific segment register or address within a specific memory region. Then there can be alignment issues.

    In the end - if the pointers really can be used as you want, then there is no need for any flag to turn off that warning number because there are C language constructs available to type cast the pointer. And if the pointers really aren't compatible enough, then turning off any warnings will not result in a correct program.

Reply
  • From your answer, we know that you don't understand this issue. So maybe you really should spend some time to debate this issue.

    If the two pointers really are compatible, then a type cast in C wouldn't add any extra code or consume clock cycles. It would be a pure syntactic construct to tell the compiler "yes, I know the pointer is type A but but is compatible enough that I want to use it as if it was type B". The only conversion happening would be of the meta information kept within the symbol tables of the C compiler while it was busy generating the code.

    It does not cost time to convert an int* pointer into a char* pointer - except the few seconds it takes to tell the compiler that you really want to use the int* pointer as if it was a char* pointer.

    But the next issue is that actual pointer types can matter a lot depending on architecture and used compiler. Such as size of pointer (near, far, huge), or a "based" pointer that might operate relative to a specific segment register or address within a specific memory region. Then there can be alignment issues.

    In the end - if the pointers really can be used as you want, then there is no need for any flag to turn off that warning number because there are C language constructs available to type cast the pointer. And if the pointers really aren't compatible enough, then turning off any warnings will not result in a correct program.

Children
No data