Re: C Interview Questions



Keith Thompson wrote:

If a header contains a function definition, and that header is
included in two or more translation units in the same program, Bad
Things Could Happen. (I'm too lazy to figure out whether it's
undefined behavior, a constraint violation, or whatever.)

Bad things don't happen if the function definitions are static,
or if it is C99 and they are inline

.



Relevant Pages

  • Re: [opensuse] Linking problem with g++ [off topic]
    ... Bogdan Cristea wrote: ... and use the header XP_class.h into another file xml_parser.cpp to ... Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org ...
    (SuSE)
  • Re: including files
    ... (I want to use some functions of the included file, which is not the "main" function, can I just declare the functions I want to use only at the header). ... void f; // declaration, no definition ... That way you can be sure that the prototype matches the actual function definition. ...
    (microsoft.public.vc.language)
  • Re: error: implicit declaration of function `func_name
    ... The actual function definition is in /source/folderB/fileB.c. ... warning: implicit declaration of function `func_name' ... Include the correct prototype for func_name in a header and include ...
    (comp.lang.c)
  • Re: typical practise for #includes
    ... In my opinion it would be very simple to make ONE big header, ... which include in every unit's header file. ... some of these headers might be useless in other translation units, ... unnecessary compile dependencies -- every time one of the ...
    (comp.lang.c)
  • Re: Bug in list of matrics represended as arays.....
    ... Keith Thompson wrote: ... snip ... ... header, and using it, though not wise, isn't necessarily ...
    (comp.lang.c)