Maybe someone can think of a reason that it should work this way
From a HW point of view, I can imagine circuitry that detects falling and rising edges, as well as levels, that would be active all the time (whether or not interrupts are enabled.) Enabling the pin change interrupt causes an immediate interrupt, because sure enough there HAS BEEN a falling edge some time in the past, even though it wasn't set up to cause interrupts. I think the timer interrupts work like this too. If you've been running the timer for a while without paying attention to the pieces that cause interrupts, the "overflow" bit will be set (you never cleared it, after all) and will cause an interrupt as soon as you enable timer overflow interrupts.
Good point. And indeed as one example the datasheet has a similar warning that changing the settings for the analog comparator can cause an interrupt. Unless I missed it though, they must have forgotten to mention this one in connection with external interrupts.
I did google around and also searched the forum a bit to see if anyone had noticed this before, and didn't come up with anything. On the one hand that's hard to believe, but being a sort of boundary condition thing, people might just tend to code around it if it makes a difference to them rather than digging into it.
As I also discovered (code in #9 above), the Arduino interrupt functions also cause this spurious interrupt. Do you guys think it's worth raising an issue on? Seems pretty serious to me, I don't expect a freebie interrupt just because I enable them. Simple enough fix, but I was looking at WInterrupts.c and I see it would have to be made in a couple dozen places!
