Function Prototype Identifying Issue ?? [message #1385922] |
Thu, 12 June 2014 09:37 |
Deepak P Messages: 32 Registered: January 2012 |
Member |
|
|
Hello All,
Recently when working with CDT found out an issue when identifying the Function Prototype (Function Declaration).
The scenario goes as mentioned below,
Consider a c file which contains a function prototype as mentioned below
int sum(int,int); // argument variable names are missing
When this is parsed by CDT, the Signature of the function is given as "sum()" instead of "sum(int, int)"
Now instead if the same is declared as below
int sum(int a, int b); // Giving variable names for the arguments
CDT identifies the signature correctly. ie., we get sum (int, int)
So is there a way to identify the arguments of the function prototype even when the argument variables doesnt contain name ??
Regards,
Deepak P
|
|
|
|
|
Re: Function Prototype Identifying Issue ?? [message #1386375 is a reply to message #1386291] |
Tue, 17 June 2014 08:21 |
Axel Mueller Messages: 1973 Registered: July 2009 |
Senior Member |
|
|
You are right. This is legal C code.
I just tried with a simple program and Eclipse Kepler (CDT 8.3).
Header with prototype declaration
int sum(int,int);
no implementation in .c file
When I type "sum" in my main.c and then hit Ctrl-Space Eclipse suggests "sum(int,int): int".
When I have an implementation in a .c file then Eclipse suggests "sum(int a,int b): int".
It also works when I put the empty declaration in the .c file. See attached screen shot
Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
|
|
|
Powered by
FUDForum. Page generated in 0.04271 seconds