What does “warning: not all control paths return a value” mean? (C++)

前端 未结 7 1292
梦谈多话
梦谈多话 2020-12-20 07:18

The exact warning I get is

warning C4715: \'hand::show\' : not all control paths return a value

and hand::show is

std::ostr         


        
7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-20 07:53

    The error means that if side is neither left nor right, your function will not return a value - either side is declared improperly or your enum is. An enum should be defined like

    enum orientation {left, right};
    

    So try changing your orientation structure to that.

提交回复
热议问题