Re: questions about gcc options

From: Lowell Gilbert (freebsd-questions-local_at_be-well.ilk.org)
Date: 11/29/05

  • Next message: werther.pirani_at_nexgo.de: "Re: sm-mta[386]: My unqualified host name ..."
    To: Mamta BANSAL <mamta.bansal@st.com>
    Date: 29 Nov 2005 08:33:25 -0500
    
    

    Mamta BANSAL <mamta.bansal@st.com> writes:

    > Hello
    > for a c code i am using gcc compiler.
    > i have doubt using -c option.
    > for a c code the code compiles (without error ) with -c option even if
    > i don't provide prior declaration of function.
    > i mean i have try.c
    > //*******************
    >
    > void my_func( ){
    > call_to_undeclared_func( );
    > }
    > //********************
    > i do : gcc -c try.c , it works.
    > is it the correct behaviour , i mean should it not ask for atleast
    > declearation of call_to_undeclared_func( );
    >
    > like if my make the same as try.cpp then usen use the same command it
    > gives the foll. error.:
    >
    > try.cpp: In function `void my_func()':
    > try.cpp:2: implicit declaration of function `int
    > call_to_undeclared_func(...)'
    > which i feel is expected behaviour.

    That doesn't require a diagnostic in C, but it does in C++.

    If you want the diagnostics anyway, use the
    -Wimplicit-function-declaration flag to the compiler. Or -Wall, which
    adds a pretty extensive set of non-required warnings. See the gcc
    manual if you want more information.
    _______________________________________________
    freebsd-questions@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-questions
    To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"


  • Next message: werther.pirani_at_nexgo.de: "Re: sm-mta[386]: My unqualified host name ..."

    Relevant Pages

    • questions about gcc options
      ... for a c code the code compiles with -c option even if i ... don't provide prior declaration of function. ... is it the correct behaviour, i mean should it not ask for atleast ... try.cpp: In function `void my_func': ...
      (freebsd-questions)
    • Re: something to do with void *
      ... Either a warning ... it's allowed to produce any additional diagnostics it likes. ... If a compiler in conforming mode doesn't produce a diagnostic for the ... to have a void expression in some contexts, ...
      (comp.lang.c)
    • [PATCH] fix for Re: timer + fpu stuff locks my console race
      ... > I'm doing some code tests when I came across problems with my program ... +static inline void tolerant_fwait ... * the correct behaviour even in the presence of the asynchronous ... +void simd_math_error(struct pt_regs *regs) ...
      (Linux-Kernel)
    • Re: [9fans] warning of putchar
      ... the diagnostics make sense after expansion. ...
      (comp.os.plan9)
    • Re: Recursively
      ... Need some clarification regarding the following example w.r.t ... void f ... It should actually return without printing anything. ... If you don't understand the logic, put in some diagnostics. ...
      (comp.lang.c)