what's wrong with it?
Zhiyong Xu
rodgexu@yahoo.com
Fri Mar 23 18:52:00 GMT 2007
I knew if I put real number parameters, it will work
fine.
I just want to know if I did not put function
prototype, how system will deal with it, and why it
generate this error.
Could you please tell me? Thanks,
--- Andrew Haley <aph@redhat.com> wrote:
> Zhiyong Xu writes:
>
> >
> > here's the description:
> > 1. I have a function evaluate defined in t.c
> > 2. in ex.c, I call function evaluate without
> prototype
> > defined.
> > using gcc -lm ex.c t.c, I can generate the
> executable
> > file a.out,
> > when executing, the result is wrong
> > 3. if I modify ex.c, add the prototype
> definition, the
> > result is correct.
> >
> > Anything wrong with the first case?
>
> Yes:
>
> int main(void)
> {
> evaluate(sin, 2.0,3.0,4.0);
> evaluate(sqrt,2.0,3.0,4.0);
>
> return(0);
> }
>
> But working without ptototypes is stupid and
> pointless. Don't do it.
>
> Andrew.
>
____________________________________________________________________________________
Sucker-punch spam with award-winning protection.
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html
More information about the Gcc-help
mailing list