Re: GCC problem



westymatt <westymatt@xxxxxxxxx> wrote in news:1184743157.214777.263570
@z28g2000prd.googlegroups.com:

I switched my code over to using what I believe to be the K&R style
function definitions.

As others have already noted, that's not a terribly sane thing to do. I
really can't imagine why you would want to do so. However gcc will still
happily accept the code if you give it proper K&R syntax.

63 /*pcap_loop callback routine*/
64 void
65 capture_callback(buffer, packet_header, data)
66 u_char *buffer, const struct pcap_pkthdr
*packet_header, u_char *data;

The function arguments should be separated by semicolons:

void capture_callback(buffer, packet_header, data)
u_char *buffer;
const struct pcap_pkthdr *packet_header;
u_char *data;
{
/* function body */
}

Also, you should know that the keywords "const" and "void" did not exist
back in original K&R days.


GH
.



Relevant Pages

  • Re: LNK 2001 error !!!!!!!!
    ... Wrap the function definitions in an extern "C" block... ... void SomeFunction(void); ... > I have a MFC project in which I need to include source file with ".c" ... > error for functions defined in the files with ".c" extension. ...
    (microsoft.public.vc.mfc)
  • Re: GCC problem
    ... function definitions. ... You should buy the second edition before doing that. ...
    (comp.os.linux.development.system)
  • Re: if I define a function with no parameters, should i put void?
    ... > For function definitions (not declarations/prototypes), ... > to put void in the emptry braces if the function is to receive no ...
    (comp.lang.c)
  • if I define a function with no parameters, should i put void?
    ... For function definitions (not declarations/prototypes), ... to put void in the emptry braces if the function is to receive no ...
    (comp.lang.c)