This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Error and warning in CCSv5.

I was building my code using CCSv5, i got following error and warning. so please tell me how to resolve it. Thank you:)

Warning: #179-D variable "constant_DAC_VALUE_SCALER" was declared but never referenced

      >>Statement: struct qnote constant_DAC_VALUE_SCALER = {DAC_VALUE_SCALER, 0};


 Error: Description Resource Path Location Type #1311-D nonstandard conversion between pointer to function and pointer to data interrupts.

     >> Statement: register Uint32 * source_index = (Uint32 *)zero_out_integrity_word;

  • Rahoo US said:
    Warning: #179-D variable "constant_DAC_VALUE_SCALER" was declared but never referenced

    To remedy this warning, either make sure to use the variable or don't declare it.

    Rahoo US said:
    Error:  #1311-D nonstandard conversion between pointer to function and pointer to data

    This error message was slightly garbled in your post; the quoted text is the corrected version.

    zero_out_integrity_word is a function. It is not strictly conforming C to cast a function pointer to be a data pointer. On some targets, a function pointer is larger than a data pointer, so this construct is not portable. You need to use a function pointer:

    register void (*source_index)(void) = zero_out_integrity_word;

    See http://c-faq.com/ptrs/generic.html

  •  

    Hi Archaeologist,


    What about return type, you declared as void here.

           You wrote: register void (*source_index)(void) = zero_out_integrity_word;

           My statement: register Uint32 * source_index = (Uint32 *)zero_out_integrity_word;

    are they same??

  • No, yours declares a data pointer and mine declares a function pointer.  Please see http://c-faq.com/ptrs/generic.html

    You did not show the prototype for zero_out_integrity_word, so I do not know what the return value or arguments should be.  However, the C standard allows any function pointer to be cast to a function pointer of another type.

  • Okay, i'm sorry for that...

    Thanks:)