Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
Why does the declaration extern int .....
Why does the declaration
extern int f(struct x *p);
give me an obscure warning message about ``struct x declared inside parameter list''?
✍: Guest
In a quirk of C's normal block scoping rules, a structure declared (or even mentioned) for the first time within a prototype cannot be compatible with other structures declared in the same source file. (The problem is that the structure and the tag go out of scope at the end of the prototype;
To resolve the problem, you should probably rearrange things so that the actual declaration of the structure precedes the function prototype(s) using it. (Usually, both the prototype and the structure declaration will end up in the same header file, so that the one can reference the other.) If you must mention a hitherto-unseen structure in a prototype, precede the prototype with the vacuous-looking declaration
struct x;
which places an (incomplete) declaration of struct x at file scope, so that all following declarations involving struct x can at least be sure they're referring to the same struct x.
2016-01-11, 1299👍, 0💬
Popular Posts:
Can two catch blocks be executed? No, once the proper catch section is executed the control goes fin...
How To Write a Query with a Right Outer Join? - Oracle DBA FAQ - Understanding SQL SELECT Query Stat...
What are database triggers? How are the triggers fired? Read this collection of questions and answer...
.NET INTERVIEW QUESTIONS - What is COM ? Microsoft’s COM is a technology for component software deve...
What invokes a thread's run() method? After a thread is started, via its start() method of the Threa...