Naming: Why should named constants be all uppercase in C++/Java?

前端 未结 15 1782
情歌与酒
情歌与酒 2020-12-15 16:13

I know, that for C++ and Java it is a well established naming convention, that constants should be written all uppercase, with underscores to separate words. Like this (Java

15条回答
  •  猫巷女王i
    2020-12-15 16:38

    Probably you are right. Computers and compilers (especially) were not so fast as today.

    Joel Spolsky mentioned in one of his essays how impressed he was with compilation time of new version of Turbo Pascal.

    I remember when compilation of not too big program (10-20KLOC) with overlays in Turbo Pascal 5.0 on PC XT 10MHz took about 20 minutes...

    I suppose that waiting for compilation to detect error was not acceptable.

    And convention like that helps to avoid errors and wasted time during broken compilation.

提交回复
热议问题