Unsigned keyword in C++

后端 未结 5 1583
醉酒成梦
醉酒成梦 2020-12-02 08:38

Does the unsigned keyword default to a specific data type in C++? I am trying to write a function for a class for the prototype:

unsigned Rotate(unsigned ob         


        
5条回答
  •  忘掉有多难
    2020-12-02 09:15

    Yes, it means unsigned int. It used to be that if you didn't specify a data type in C there were many places where it just assumed int. This was try, for example, of function return types.

    This wart has mostly been eradicated, but you are encountering its last vestiges here. IMHO, the code should be fixed to say unsigned int to avoid just the sort of confusion you are experiencing.

提交回复
热议问题