ian (01/27/83)
The following was received from J. E. Hendrix, author of Small C V2. "Dear Small-C User: "This notice is to let you know of a bug in version 2 of the Small-C compiler as published in DDJ # 74 and # 75. It turns out that a *continue* statement within a *switch* does not work properly. It generates a jump to an undefined label. To correct this problem, I recommend the following patch: "First, in the function *doswitch* below the call to *addwhile* (line 184, page 39, DDJ # 74) insert the line *(wqptr + WQLOOP - WQSIZ) = 0; "Then change the following functions to read as shown. Modified lines begin with a # character. (page 42, DDJ # 74) dobreak() { int *ptr; # if ((ptr=readwhile(wqptr))==0) return; modstk((ptr[WQSP]), NO); jump(ptr[WQEXIT]); } docont() { int *ptr; # ptr = wqptr; # while (1) { # if ((ptr=readwhile(ptr))==0) return; # if (ptr[WQLOOP]) break; # } modstk((ptr[WQSP], NO); jump(ptr[WQLOOP]); } (page 45, DDJ # 74) delwhile() { # if (wqptr > wq) wqptr=wqptr-WQSIZ; } #readwhile(ptr) int *ptr; { # if (ptr <= wq) { # error("out of context"); return 0; } # else return(ptr-WQSIZ); } "This code will compile with the original compiler. If you uncover any other problems, please let me know and I will try to get the word out. "Sincerely, [signed] J. E. Hendrix'' I've just typed this in from a photocopied letter, so there may be errors. Check it over, and try it. Ian Darwin, U of Toronto Computing Services.