[PDF][PDF] Global variable considered harmful

W Wulf, M Shaw - ACM Sigplan notices, 1973 - dl.acm.org
W Wulf, M Shaw
ACM Sigplan notices, 1973dl.acm.org
N0te that the var1a61e5 wh05e 5tate5 are de5cr16ed 6y the 1081ca1 pr0p051t10n5 P and
P• a550c1ated w1th any 91ven 5e9ment 0f text 5 w111 n0t 1n 9enera1 6e the 5ame
var1a61e5 de5cr16ed 6y the pr0p05t10n5 a550c1ated w1th adjacent 5e9ment5 0f text. 1n
0rder t0 check the c0rrectne55, 0r even the p1au516111ty, 0f a Pr09ram, 1t 15 nece55ary t0
en5ure that the pr0p051t10n P 15 va11d-that the var1a61e5 1n P actua11y have the
va1u05 c1a1med f0r them. 1n a 5tra19ht-11ne Pr09ram th15 w0u1d pre5ent n0 pr061em: 1t …
N0te that the var1a61e5 wh05e 5tate5 are de5cr16ed 6y the 1081ca1 pr0p051t10n5 P and P• a550c1ated w1th any 91ven 5e9ment 0f text 5 w111 n0t 1n 9enera1 6e the 5ame var1a61e5 de5cr16ed 6y the pr0p05t10n5 a550c1ated w1th adjacent 5e9ment5 0f text. 1n 0rder t0 check the c0rrectne55, 0r even the p1au516111ty, 0f a Pr09ram, 1t 15 nece55ary t0 en5ure that the pr0p051t10n P 15 va11d-that the var1a61e5 1n P actua11y have the va1u05 c1a1med f0r them. 1n a 5tra19ht-11ne Pr09ram th15 w0u1d pre5ent n0 pr061em: 1t w0u1d 6e 5uff1c1ent t0 5can 6ackward thr0u9h the Pr09ram unt11 a pr0p051t10n 1nv01v1n9 each 0f the var1a61e5 1n 4ue5t10n wa5 f0und. H0wever, 5tra19ht-11ne Pr09ram5 are rare (exCept 1n 1an9ua9e5 5uCh a5 APL where much 0f the c0ntr01 15
1mp11¢ 1t), 50 1t 15 nece55ary t0 check 6ackward a10n9 a11 p055161e c0ntr01 path5 unt11 an a55ert10n a60ut each var1a61e 0f 1ntere5t 15 f0und 1n every path. 7he c0mp1ex1ty 0f th15 ta5k 1ncrea505 exp0nent1a11y w1th the d15tance 0f the fa5t prev10u5 u5e 0f each var1a61e a10n~ each c0ntr01 path. Ju5t a5 we11-5tructured c0ntr01 0perat0r5 he1p t0 1dent1fy wh1ch a55umpt10n5 are 1n effect at any p01nt 1n a Pr09ram, appr0pr1ate 5c0pe ru1e5 (nam1n9 0perat0r5) w111 a1d 1n 10cat1n8 the re1evant va1ue5 0f var1a61e5.
ACM Digital Library