473,671 Members | 2,121 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

K&R style declaration

void
capture_callbac k(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_callba ckâ:
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 6155
we*******@gmail .com wrote:
void
capture_callbac k(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_callba ckâ:
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.netwr ites:
we*******@gmail .com wrote:
>void
capture_callba ck(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
8229
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 xmlns:xc="http://www.wolterinkwebdesign.com/xml/xcontent" xmlns="http://www.w3.org/1999/xhtml" module="gastenboek"> <xc:bericht> <xc:id>1</xc:id> <xc:naam type="string"><!]></xc:naam>
3
5497
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 area allows one to overide the normal formatting of the entire page and truly customize it. But there is a span-style tag which gives an ugly blue background to certain text which I want to get rid of. This is the tag: <span...
27
3369
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 trouble making the code at the end of Chapter 5 -- the sort function that uses function pointers -- to work on my machine (233 Mhz iMac, 160 MB RAM, OS 9.2 ; MPW environment). When I try to compile sort.c with the Symantec C compiler it gives me all...
28
15357
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 (frame_size,num_blocks,num_frames,frame_locator) size_t frame_size; unsigned short num_blocks; unsigned short num_frames; Kl_frame_locator *locator; { /* code goes here */
33
2251
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 modify_pointer(char *); int main(int argc, char *argv) {
5
3964
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 variable **var make it an array of pointers? I realize that 'char **var' is a pointer to a pointer of type char (I hope). And I realize that with var, var is actually a memory address (or at
18
2319
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 Firefox it works well (a few minor problems) but when I test it with IE 6.0 it doesn't display or it jumbles everything up. I've tried using various examples (conditionals) to get around IE problems but they are causing more problems that they...
100
4711
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 use comments. Thanks in advance! -- http://www.gotw.ca/resources/clcm.htm for info about ]
13
3026
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 the
4
2045
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"> <option id="thisone" class="message">THANK YOU</option> </select>
0
8476
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8393
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8914
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8670
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7433
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6223
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1809
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.