473,511 Members | 14,975 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

K&R style declaration

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

devbox:~/projects/packet_capture$ gcc -c packman.c
packman.c: In function âcapture_callbackâ:
packman.c:66: error: expected identifier or â(â before âconstâ
packman.c:76: error: invalid type argument of â->â

I am not sure how to form this declaration. I know I don't have to
use k&r, but I would just like to know.

Jul 21 '07 #1
4 6142
we*******@gmail.com wrote:
void
capture_callback(buffer, packet_header, data)
u_char *buffer, const struct pcap_pkthdr *packet_header,
u_char *data;
{
.....
}

devbox:~/projects/packet_capture$ gcc -c packman.c
packman.c: In function âcapture_callbackâ:
packman.c:66: error: expected identifier or â(â before âconstâ
packman.c:76: error: invalid type argument of â->â

I am not sure how to form this declaration. I know I don't have to
use k&r, but I would just like to know.
K&R didn't support const, so it would have to be omitted. Only recently
has gcc begun to get strict about combining K&R code where const is
unspecified with std C where it is specified, breaking the builds where
warnings are treated as fatal.
BTW, the strange characters are likely due to your not setting an
environment variable such as LANG=C.
Jul 21 '07 #2
thank you very much for your help

Jul 21 '07 #3
Tim Prince <ti***********@sbcglobal.netwrites:
we*******@gmail.com wrote:
>void
capture_callback(buffer, packet_header, data)
u_char *buffer, const struct pcap_pkthdr *packet_header,
u_char *data;
{
.....
}
....
>packman.c:66: error: expected identifier or â(â before âconstâ
....
K&R didn't support const, so it would have to be omitted.
I think that the real problem here is that the commas in the list
of declarations should be semicolons. ISO C does not forbid use
of const in K&R-style function parameter declarations.
--
"I hope, some day, to learn to read.
It seems to be even harder than writing."
--Richard Heathfield
Jul 21 '07 #4
Thank you very much worked perfectly.

Jul 21 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
8225
by: Tjerk Wolterink | last post by:
When i open the following xml file in internetexplorer: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE xc:content > <xc:xcontent...
3
5468
by: macgyver | last post by:
This is a strange question, and I think the answer is NO, but I am asking anyway. I am a member of a website which allows us to alter our member profiles. Using css in the middle of the profile...
27
3344
by: Ben Jacobs-Swearingen | last post by:
Hello, I just started learning C a couple weeks ago from Kernighan and Ritchie (first edition -- I can't afford the newer second edition), and have really enjoyed it so far. But I am having...
28
15318
by: Michael B. | last post by:
I tend to use rather descriptive names for parameters, so the old style of declaration appeals to me, as I can keep a declaration within 80 chars: void * newKlElem...
33
2218
by: hermit_crab67 | last post by:
Can someone explain to a C newbie why this doesn't work as I expect it to work? (expectations clearly outlined in the printf statement in main routine) OS: Linux 2.4.26 GCC: 2.95.4 void...
5
3940
by: jab3 | last post by:
(again :)) Hello everyone. I'll ask this even at risk of being accused of not researching adequately. My question (before longer reasoning) is: How does declaring (or defining, whatever) a...
18
2305
by: Neil Cherry | last post by:
I'm in the process of redesigning my web page and started working more with CSS. I have, what I think is, a nice web layout (I'm no expert so I could be wrong). When I tested it with Konqueror and...
100
4616
by: Angel Tsankov | last post by:
Can someone recommend a good source of C/C++ coding style. Specifically, I am interested in commenting style and in particular how to indent comments and the commented code, rather than when to...
13
3016
by: Old Wolf | last post by:
I have some code that has in the header file: void foo( char bar ); and in the source file: void foo( bar ) char bar; { /* etc. */ } The compiler (with many warnings enabled) warns that...
4
2039
by: rebeccatre | last post by:
please help me with this, <style> #a, option.message {background-color: green; color: white;} #b, option.message {background-color: yellow; color: black;} </style> <select id="thisselect">...
0
7252
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7371
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7093
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5077
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1583
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.