On Mon, 2004-10-04 at 04:32, Alan B. Pearce wrote: > >My personal preference is that the compiler didn't do > >more then it was asked of. There is no such this as > >"exiting main" on the PIC, to define a behaviour is > >simply silly since it SHOULD NEVER HAPPEN. > > True, but only in that using C on a PIC (or any other microcontroller) is a > hack, in that the C standard allows main() to return, and so some provision > needs to be made to allow for things to not blow up. No, the standard only says the behaviour must be defined. Something like a compiler time warning would probably be enough, and far more appropriate. > >Sloppy coding is the ONLY reason something like this > >would happen, and the compiler "fixing" sloppy coding > >is what I'm really against. > > This sounds like someone who never makes errors in their code talking. Nope. > Personally I find the "fix" for falling out of main() reasonable, in that in > most circumstances it causes the PIC code to do a failsafe operation instead > of (possibly) falling through to code that could damage hardware (think in > terms of turning on all arms of an H-bridge). Agreed you were talking in > terms of this particular minimalist program, but it does show that the > compiler designer has done something to "fail safe" in the event of a > mistype in the source code. That would surely make me add some brownie > points for that compiler if looking at compiler options. Failsafe huh? How do you know the init sequence called from main in some program doesn't do something "dangerous" to external hardware if repeated? How about something as simple as writing something to EEPROM during init, this "loop forever" could end up killing the write endurance of your EEPROM, while if nothing were done the code might hit a sleep. There is NOTHING fail safe about this silly idea. ----------------------------- Herbert's PIC Stuff: http://repatch.dyndns.org:8383/pic_stuff/ _______________________________________________ http://www.piclist.com View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist