Double const declaration

后端 未结 8 1498
花落未央
花落未央 2021-02-05 13:20

I often see the following function declaration:

some_func(const unsigned char * const buffer)
{

}

Any idea why the const is repeated before th

8条回答
  •  春和景丽
    2021-02-05 13:25

    assuming const unsigned char * const

    Everyone is correct that its a const pointer to a const unsigned char.

    C++ types read mostly right to left unless there are any modifiers on the far left then these read left to right.

提交回复
热议问题