tag:blogger.com,1999:blog-21503568.post2161065212487302974..comments2023-11-03T06:32:28.410-04:00Comments on Staring At Empty Pages: Psychic debuggingBarry Leibahttp://www.blogger.com/profile/14205294935881991457noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-21503568.post-39354725085348056752007-05-01T15:24:00.000-04:002007-05-01T15:24:00.000-04:00Reminds me of how FORTRAN (at least up thru the '7...Reminds me of how FORTRAN (at least up thru the '77 level) used to allow you to change the values of constants by passing them to subroutines — not just changing the value of something like "one", but actually changing the value of "1".<BR/><BR/>It passed all parameters by reference, so if you called a subroutine with a parameter of "1", the address of the constant 1 was passed. If the subroutine then, say, incremented that parameter, the actual value of "1" would become 2 thereafter.<BR/><BR/><B>That</B> caused some weird bugs!Barry Leibahttps://www.blogger.com/profile/14205294935881991457noreply@blogger.comtag:blogger.com,1999:blog-21503568.post-26086235837578835872007-05-01T15:15:00.000-04:002007-05-01T15:15:00.000-04:00Pascal in a giant "weeder" intro programming cours...Pascal in a giant "weeder" intro programming course in the early eighties. Student asked the assembled multitude for help, so we spread the listing on the table. A subroutine and a main routine, each about two pages on large-format fanfold.<BR/><BR/>Several people standing around reading it, the author responding to questions, the usual drill.<BR/><BR/>Cut to the chase: he had a manifest constant named "one" with the value 1 declared in one module. In the other he had an integer variable named "one" -- unitialized, of course.<BR/><BR/>My distrust of pointless manifest constants was the key to "psychic" debugging this one. Other readers accepted the named constant at "face value" - literally!Anonymousnoreply@blogger.com