On 2005-03-02 17:13, Florian Hengstberger <[EMAIL PROTECTED]> wrote: > Following is possible with gcc and g++: > > #include <math.h> > > double sin(double) > { > return 1; > } > > int main() > { > sin(1); > return 1; > } > > Why I don't get any warnings like: > > sin prevously defined in math.h ... > > when I compile with -Wall -pedantic -ansi.
Are you sure? It fails to compile here: $ cc -std=c89 -pedantic sin.c sin.c: In function `sin': sin.c:3: error: parameter name omitted $ cc -std=c99 -pedantic sin.c sin.c: In function `sin': sin.c:3: error: parameter name omitted > Why is it possible to overwrite the definition of sin, is this part of > the standard? There is no definition of sin() at that point. Only a declaration (i.e. a prototype of the function). Your definition happens to match the visible prototype, so it accepts your custom definition of sin(). > Secondly the definition (not declaration) of double sin(double) misses > a variable! Is this ok, when the variable is not referenced in the > code? This is not ok, as far as I can tell from the warnings above. _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"