473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

#include header_file

11
I have a program that #includes a number of header files. However, these header files merely contains #ifndef, #define and #endif and nothing else. This program calls a number of functions which are defined in other source files. How is it possible for the program to work when the header files did not include any declarations of the functions which are defined in those source files? The program works, however, I'm interested in finding out why the program could works. Thanks!
Dec 7 '07 #1
5 1451
oler1s
671 Expert 512MB
Two questions:
Was this C code? And second, if so, I assume it was not compiled with all warnings turned on?
Dec 7 '07 #2
TKM
11
Two questions:
Was this C code? And second, if so, I assume it was not compiled with all warnings turned on?


The program is written in C. It has quite a number of header files and they are nested as well. Is it possible for the compiler to report no error in such instances?
Dec 7 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
Not that I know of.

Functions have to be identified as functions before you call them.

The only thing I can think of is that some nitwit is including the source file that copntains the function code. Do you see any #include that are for .c files or other files that contain code??
Dec 7 '07 #4
oler1s
671 Expert 512MB
In C, you can actually compile code without declaring the function. The compiler will silently assume it to return an int, unless of course, you turned on warnings.

If the function doesn't return an int, this may be disastrous. Which is why in C it's recommended you don't cast malloc. If you forget stdlib.h, well, at runtime it definitely won't be working properly.

(Obviously, do not take my remarks as a sign that you should ever rely on the default assumption. Always declare the function before using it.)
Dec 7 '07 #5
weaknessforcats
9,208 Expert Mod 8TB
I am always heartened by comments such as yours that abandoning C for a real language, like C++, was a good idea.
Dec 7 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

43
by: steve | last post by:
I am quite frustrated with php’s include, as I have spent a ton of time on it already... anyone can tell me why it was designed like this (or something I don’t get)? The path in include is...
7
by: mark | last post by:
I am designing a website at the moment and looking at the difference between relative and absolute url links which is driving me crazy! I would like to use relative paths, but it is proving very...
28
by: Ramesh | last post by:
Hi, I am currently maintaining a legacy code with a very very large code base. I am facing problems with C/C++ files having a lot of un-necessary #includes. On an average every C/C++ file has...
60
by: Derrick Coetzee | last post by:
It seems like, in every C source file I've ever seen, there has been a very definite include order, as follows: - include system headers - include application headers - include the header...
9
by: zolli | last post by:
Hi, I've been banging my head against this for a while now. Hoping someone here can shed some light on what's going on. On including stdlib.h in a file, I'm seeing the following errors: ...
5
by: David Mathog | last post by:
One thing that can make porting C code from one platform to another miserable is #include. In particular, the need to either place the path to an included file within the #include statement or to...
1
by: ya man | last post by:
when i use #include <iostream.h> in some files i get lots of error messages of the kind 'ambiguous symbol this is solved when i use #include <iostream why is that ? and can i use #include...
3
by: Arpi Jakab | last post by:
I have a main project that depends on projects A and B. The main project's additional include directories list is: ...\ProjectA\Dist\Include ...\ProjectB\Dist\Include Each of the include...
13
by: James | last post by:
I have a bunch of conditional #include statements like #if PLATFORM == "LINUX" #include "LinuxImplementation.h" #elif PLATFORM ==" WINDOWS" #include "WindowsImplementation.h" #elif PLATFORM...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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
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...
0
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,...

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.