mac C ++ programming specification

This article summarizes some of the lessons, so compiled out of the code more robust.

1, when the definition of class / structure and system functions do not conflict (especially portable between different systems / platforms time)

Sometimes the windows system compiler no problem, but to die in linux system, it is because there is a function of the same name under linux.

Better compiler will prompt: Must use 'class / struct' tag to refer to type 'XXX' in this scope; I use VScode they reported this error
almost directly compiler can not find the type and throw a heap error, confusing.

This time there are two solutions, one is your own definition of the class when in use, preceded by class or struct (can be mixed); Another way is to get rid of their own definition of the class name / structure name .

Guess you like

Origin blog.csdn.net/weixin_44769592/article/details/92383386