Re: Error a:\t_mayn.c:12 illegal return type, found 'int' expected 'void'



obrhy8[at]yahoo.com July 9, 2005

Dave Hansen wrote:

> An implementation (C compiler) is allowed to support any prototype for
> main that it likes, but it is only _required_ to support two. If you
> want your code to work on any given C compiler, the main you use must
> conform to one of those prototypes. Both of those require main to
> return an int.
>
> >
> >2. The error message I recieved was in plain english
> > but it gave me not a clue as to the nature of my
> > offence.
> >
> >Do you, Jacob, perhaps have a belief that all C programers
> >know everything, and if they make a mistake or commit an
> >error, that they did it 'on purpose' and therefore deserve
> >a pie or piece of pie in the face?
> >
> >I assure you, sir, the real world is not like that.
> >hugo ---
> >
> Jacob has promised to fix the message. But if you imagine that coming
> up with sensible error messages is in any way "easy," especially in a
> program such as a compiler, that has to deal sensibly (as it can) with
> any random input it might receive, you do indeed live in a world
> different from the rest of us.

I take your point. I myself have witten exception/error handling
code for a Javascript utility, but it was a much smaller and
simpler context. I do know that one must be well rested and
fed to write such code. If one is stressed out, tired at all,
physically or mentally, it is easy to make a bad job of it.

What I do not know is how much of the ~20 MB (installed)
is the actual front end of the compiler (the lexical analizer
and the parser), and how much of that is given to error code.

> The code you posted was in error. The error message clearly pointer
> to the declaration of "main" as a problem. That's far better than
> I've come to expect at least one commercial compiler (targetting an
> embedded 8-bit microcontroller) to provide.

I disagree. Only those 'in the know' whould understand the msg,
(it did *not* mention 'main') and they whouldn't make the mistake
in the first place. To me the msg was 'insane', it saw something
that wasn't there.
Here is perhaps a better, truer, error msg for the foke:

error:[file][line#] main illegal return type found 'void' expected
'int'

yours truly, hugo------

.



Relevant Pages

  • Re: Error a: _mayn.c:12 illegal return type, found int expected void
    ... > a given compiler writer allows or forbids is ... The error message I recieved was in plain english ... >Do you, Jacob, perhaps have a belief that all C programers ... the purpose of lint is to provide error messages. ...
    (comp.compilers.lcc)
  • understanding segmentation faults
    ... Is "segmentation fault" an error message that is issued by the operating ... not a problem that the compiler vendors can easily solve. ... technical terminology an "array section"?). ...
    (comp.lang.fortran)
  • Re: operator function
    ... >> of them have anything to do with what the error message seems ... Setting (int h, int m, int s, int TT) ... Now the compiler knows, that it is safe to use that function on a const ... >> operator returns a Setting object. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: ILC2005: McCarthy denounces Common Lisp, "Lisp", XML, and Rahul
    ... SU-AI and run Lisp 1.6 or UCI-Lisp. ... kernel of an operating system or a compiler etc. ... have the power of Lisp instead of only C to manipulate those lists. ... apply so the error message doesn't occur. ...
    (comp.lang.lisp)
  • c89 problem w/ irrhfsu
    ... i've got a lot of experience setting up and configuring OMVS but not ... by means of the c89 compiler, inside the OMVS environment, (this is ... and i received the following error message: ...
    (bit.listserv.ibm-main)