Mail Archives: djgpp/1996/09/06/13:29:25
Paul Shirley (Paul AT chocolat DOT foobar DOT co DOT uk) wrote:
: A microcontroller is a tiny processor system used in things like remote
: controls, toasters and CD players. It may have CPU,ROM,RAM and IO all on
: 1 chip.
: It almost always runs just 1 program, which exits catastrophically when
: the user kills the power... now tell me again, what was the return value
: used for?
None of which is relevant.
The fact is simple, the C-standard **requires** main to be defined as
returning int. If you don't do that then the behaviour is undefined (which
means that the program would be "within its rights" to reformat the hard disk,
or anything else).
If there are some situations (like microcontrollers) where you need to define
main differently, then __you__are__not__using__ansi__C__ ! You are using some
extension to ansi C which has been specifically created for use in that
situation.
However, I don't believe gcc has any such extension ?
Badders
- Raw text -