Skip to main content

Posts

Showing posts with the label style note

Style Note in C

Some programmers complain about the use of global variables in a program.  One complaint is that it is difficult to see what information is being passed  to a function unless all that information is passed as parameters. Sometimes  global variables are very useful however, and this problem need not be crip pling. A way to make this clear is to write global variables in capital letters  only, while writing the rest of the variables in mainly small letters.. int GLOBALINTEGER; .... { int local integer; } This allows global variables to be spotted easily. Another reason for restrict ing the use of global variables is that it is easier to debug a program if only  local variables are used. The reason is that once a function capsule is tested  and sealed it can be guaranteed to work in all cases, provided it is not af fected by any other functions from outside. Global variables punch holes in the sealed function capsules because they allow bugs from oth...