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.

DSPLink and const

I'd like to make a feature request. I'd like see the "const" qualifer added to appropriate parameters inhe DSPLink API. A lot of parameters are obviously const but passing const parameters produces compiler warnings. I am not really fond on turning off warnings or avoiding the use of const.

 

  • Can you provide a concrete example?

    I'm not sure we could address this without breaking API compatibility.

    Chris

  • EXPORT_API
    DSP_STATUS
    PROC_load (IN   ProcessorId  procId,
               IN   Char8 *      imagePath,
               IN   Uint32       argc,
               IN   Char8 **     argv) ;

    EXPORT_API
    DSP_STATUS
    PROC_load (IN   ProcessorId  procId,
               IN   CONST Char8 *      imagePath,
               IN   Uint32       argc,
               IN   CONST Char8 * CONST     argv[]) ;
    ------------
    EXPORT_API
    DSP_STATUS
    MSGQ_open (IN     Pstr         queueName,
               OUT    MSGQ_Queue * msgqQueue,
               IN     MSGQ_Attrs * attrs) ;

    EXPORT_API
    DSP_STATUS
    MSGQ_open (IN     CONST Pstr         queueName,
               OUT    MSGQ_Queue * msgqQueue,
               IN     CONST MSGQ_Attrs * attrs) ;
    ------------
    EXPORT_API
    DSP_STATUS
    MSGQ_locate (IN     Pstr               queueName,
                 OUT    MSGQ_Queue *       msgqQueue,
                 IN     MSGQ_LocateAttrs * attrs) ;

    EXPORT_API
    DSP_STATUS
    MSGQ_locate (IN     CONST Pstr               queueName,
                 OUT    MSGQ_Queue *       msgqQueue,
                 IN     CONST MSGQ_LocateAttrs * attrs) ;
    ------------
    EXPORT_API
    DSP_STATUS
    MSGQ_locateAsync (IN Pstr                     queueName,
                      IN MSGQ_Queue               replyQueue,
                      IN MSGQ_LocateAsyncAttrs *  attrs) ;

    EXPORT_API
    DSP_STATUS
    MSGQ_locateAsync (IN CONST Pstr                     queueName,
                      IN MSGQ_Queue               replyQueue,
                      IN CONST MSGQ_LocateAsyncAttrs *  attrs) ;

    I've used "CONST" instead of "const". Seems to be the DSPLink style of avoiding any actual "C" language. Almost any parameter with the fake "IN" qualifier and is a pointer would be candidate for const. Some "IN" parameters appear to be really "IN OUT". Those shouldn't be const.