473,395 Members | 1,689 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,395 software developers and data experts.

query on #ifndef _FILENAME_C

There are #ifndef _FILENAME_H used in header files and I very well
understand their usage. But I dont know what's the exact use when
#ifndef _FILENAME_C is used for c files. can anyone provide me an
explanation ????

Thanks
Ahmed.

Nov 14 '05 #1
2 1451
S. Md. Kabeer Ahmed wrote:
There are #ifndef _FILENAME_H used in header files and I very well
understand their usage. But I dont know what's the exact use when
#ifndef _FILENAME_C is used for c files. can anyone provide me an
explanation ????


You mean include guards in .c files? I haven't seen such things either, can
you give a concrete example? Note however that C doesn't distinct between
header and source files, so you can very well #include "foo.c", and in
some cases it might make sense. What doesn't make sense in these rare
cases is to add include guards, since those .c files are never included by
other headers and I have never seen a case where one such .c file included
another.

Uli

Nov 14 '05 #2
Hi Uli,

Thanks for the quick response Uli. In one of the project I have seen
this and I too wonder whats the purpose of doing this.
Thanks again,
Ahmed.

Nov 14 '05 #3

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

Similar topics

4
by: Evan | last post by:
Is there any standard for when to use #if !defined(SOME_INCLUSION_GUARD) versus #ifndef SOME_INCLUSION_GUARD? Aside from being able to combine multiple things into an #if, is there any...
3
by: prettysmurfed | last post by:
Hi all I have this, probably stupid question, how to avoid multiple definitions when a header file is included more than once. I thought, when you wrote the header-file and used the...
5
by: DrUg13 | last post by:
#ifndef HEADER_H #define HEADER_H blah blal #endif So this tells the compiler That if its defined do not define it again. Could someone help me understand this. Does this mean that if I...
3
by: Michael Sgier | last post by:
Hello I get the error below. But why and what does ifndef? Well what is ifndef? Many thanks and regards Michael error: syntax error before `(' token #ifndef MD2SwapInt static __inline__...
25
by: John Hanley | last post by:
I have a program where both my main.c and program.c files use the program.h file. So I #include "program.h" in both the .c files. The program.h file has #ifndef PROGRAM_H #define PROGRAM_H...
9
by: Qiao Jian | last post by:
I am new to c. Today I just read an h file within which there is statements: #ifndef _RANDOM_H #define _RANDOM_H So what is the meaning or purpose of this statement? When should I use such...
5
by: vfunc | last post by:
Despite a #ifndef I am getting a redefinition error The offending .h file looks like the following #ifndef DISTRIB_H #define DISTRIB_H double dblpi; // this is getting compiled twice ...
6
by: canoewhiteh2o | last post by:
I am converting a couple of C header files to C#. It is mainly just a bunch C structs but I am not sure how to handle the #ifdef and #ifndef in C#. For example: #ifndef DATE_TIME #define...
7
by: Studlyami | last post by:
Okay I have been wondering this for a while now. I am a little confused on the difference between these two defines #pragma once & #ifndef. From my understanding #pragma is compiler...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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...

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.