Howdy Vad, As the recent recipient of the "Famous Error" award I am now overly sensitive to the issue of compiler errors and questions... I just wanted to make one point -- on the real exam, we NEVER say "A compiler error on line [whatever]." We always say, "Code will not compile BECAUSE of an error on line [whatever]." Because we cannot guarantee exactly what a particular compiler implementation will actually *report* as the error. For example, if you leave off a curly brace, you know that this produces a compiler error. But WHERE the compiler actually reports the error (and even *what* the compiler reports) might be different from one compiler to another. So, the questions can't ask you exactly what a particular compiler error will be, or even what line the compiler will report (which is why we don't say, "A compiler error on line ..." But instead, the questions ask in which line of code the *actual* error occurred. So... I just want to make sure that everyone knows how the real exam questions are worded, and why we chose to use that wording. In our "famous error", we didn't specify at which line the compiler errored, we were wrong about the place in the code where the error happened that *caused* the compiler error... it could have been on one of TWO lines, and we were acknowledging only *one* of the two lines of code in which the real error could be. But after all that, it's quite cool that you're posting questions. There aren't enough of them floating around, and we imagine that everyone is probably getting a little tired of the ones from our book! Cheers, Kathy
posted 16 years ago
Hi Kathy, I reread your post twice, it's quite a mouthful, but this passage
on the real exam, we NEVER say "A compiler error on line [whatever]." We always say, "Code will not compile BECAUSE of an error on line [whatever]."
must have a kind of mystical power on me, it just keeps on slipping past me. I can't figure out the difference between those two statements on compiler error lines: "before, when everything was wrong...", and "now, as we're smart..." Could you please, as an example, rephrase the question from page 484 how it'd read now? [ November 03, 2003: Message edited by: Vad Fogel ]
Asking what line will get a compile error is different than asking which line has a compile error. The compiler may not recognize or it may not report the error on the line that it actually occurred. For example, leave out a semi-colon and the next line is reported as the error line.
Then, I'm back to the state of confusion out of Kathy's last post. The compiler gets code statements as tokens delimited by semi-colons. So, it should encounter at least one ending semi-colon after the statement. That semi-colon may appear anywhere after the statement, but before the next statement or the token. If this is correct in general, then how do you think the question on line errors should be worded?
Thanks tiny ad, for helping me escape the terrible comfort of this chair.