473,566 Members | 3,245 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Modifing existing header file

What are the possible effects of modifying an existing header file,
which includes bunch of defines, function prototypes and some struct
definitions. The structure of the header file looks something like
this

//Start of header
Define
Define
Define
Define
….
Define
Function prototype
Function prototype
….
Define

Struct abc {
Int m1
Int m2
};
define
define
//End of header

This header file is shared between multiple C files, which are
compiled into separate executables. However, these separate
executables run on the same machine and work in conjunction with each
other.
Let say one of the C file is changed along with the header file, where
some defines and function prototypes were added in the middle of the
file as opposed to the end of the file. After compiling the
executable that uses the modified C file, what are the chances that
the new executable will cause problems when ran with the executables
compiled with older version of the h file.
I guess the best way to go is to add them at the end of the h file.
But I am wondering what kind changes in the middle of h will not cause
major headaches granted that the members in the struct are not
changed.
I realize that this is a very general question but the code is too big
for posting. Sorry for that. Thanks in advance to anyone who can
shed some light on this.
In the case that this is not the right place to post this question,
can somebody suggest a different group
-Sujan
Nov 13 '05 #1
3 2042
Sujan Datta wrote:

What are the possible effects of modifying an existing header file,
which includes bunch of defines, function prototypes and some struct
definitions. The structure of the header file looks something like
[...]
This header file is shared between multiple C files, which are
compiled into separate executables. However, these separate
executables run on the same machine and work in conjunction with each
other.
Let say one of the C file is changed along with the header file, where
some defines and function prototypes were added in the middle of the
file as opposed to the end of the file. After compiling the
executable that uses the modified C file, what are the chances that
the new executable will cause problems when ran with the executables
compiled with older version of the h file. [...]


The programs should continue to work correctly with
each other, provided none of the data types, coded values,
and so on that they share have been changed. Adding new
types and declarations won't affect existing programs that
don't use the new stuff. Therefore, it doesn't matter where
in the header they are added.

If the header contains function and/or data definitions
as opposed to mere declarations (an uncommon practice, but
it does sometimes make sense), adding new code or new data
to the header *does* change all programs, new and old, that
use the header. Also, the position at which the new material
is added *may* make a difference.

If you're in the slightest doubt, take no chances:
recompile everything that uses the changed header.

--
Er*********@sun .com
Nov 13 '05 #2
>This header file is shared between multiple C files, which are
compiled into separate executables. However, these separate
executables run on the same machine and work in conjunction with each
other.
What does "work in conjunction with each other" mean?
Does this mean that copies of the struct are saved in disk
files which are created/used by more than one of these programs?
Let say one of the C file is changed along with the header file, where
some defines and function prototypes were added in the middle of the
file as opposed to the end of the file.
The ordering of defines and function prototypes usually doesn't
matter, unless existing code uses the symbol being newly #define'd.

On the other hand, changing a structure definition of a structure
which is saved on disk may involve recompiling *ALL* programs
that use that structure *AND* converting all existing data files
containing that structure to the new format (including the backups,
and the archives punched on cards and paper tape).
After compiling the
executable that uses the modified C file, what are the chances that
the new executable will cause problems when ran with the executables
compiled with older version of the h file.
In ANSI C, you run one program at a time. What does "run with" mean?
One program uses the other's output? In that case, it would depend
a lot on what the output IS, wouldn't it? If your changes now
allow the "sex" field to contain "Maybe" in addition to "Male",
"Female", "Yes", and "No", anything dealing with that field may
have to deal with the new possible value.
I guess the best way to go is to add them at the end of the h file.
I see no reason why that would help the problem. For example,
I see no reason why the line:
#define if else
wouldn't wreak exactly the same havoc whether you put it at
the beginning or the end.
But I am wondering what kind changes in the middle of h will not cause
major headaches granted that the members in the struct are not
changed.
I realize that this is a very general question but the code is too big
for posting. Sorry for that. Thanks in advance to anyone who can
shed some light on this.
You need to be a lot more specific.
In the case that this is not the right place to post this question,
can somebody suggest a different group


Gordon L. Burditt
Nov 13 '05 #3
go***********@s neaky.lerctr.or g (Gordon Burditt) wrote in message news:<bm******* *@library1.airn ews.net>...
This header file is shared between multiple C files, which are
compiled into separate executables. However, these separate
executables run on the same machine and work in conjunction with each
other.
What does "work in conjunction with each other" mean?
Does this mean that copies of the struct are saved in disk
files which are created/used by more than one of these programs?

One of the executable is running all the time, some are running as
daemons in the background (do not know the exact number) and couple of
the executables are invoked by the daemons directly.(by system() call)
None of the programs however write anything to a file thats is read
by another program.
Let say one of the C file is changed along with the header file, where
some defines and function prototypes were added in the middle of the
file as opposed to the end of the file.


The ordering of defines and function prototypes usually doesn't
matter, unless existing code uses the symbol being newly #define'd.

On the other hand, changing a structure definition of a structure
which is saved on disk may involve recompiling *ALL* programs
that use that structure *AND* converting all existing data files
containing that structure to the new format (including the backups,
and the archives punched on cards and paper tape).
After compiling the
executable that uses the modified C file, what are the chances that
the new executable will cause problems when ran with the executables
compiled with older version of the h file.


In ANSI C, you run one program at a time. What does "run with" mean?
One program uses the other's output? In that case, it would depend
a lot on what the output IS, wouldn't it? If your changes now
allow the "sex" field to contain "Maybe" in addition to "Male",
"Female", "Yes", and "No", anything dealing with that field may
have to deal with the new possible value.
I guess the best way to go is to add them at the end of the h file.


I see no reason why that would help the problem. For example,
I see no reason why the line:
#define if else
wouldn't wreak exactly the same havoc whether you put it at
the beginning or the end.
But I am wondering what kind changes in the middle of h will not cause
major headaches granted that the members in the struct are not
changed.
I realize that this is a very general question but the code is too big
for posting. Sorry for that. Thanks in advance to anyone who can
shed some light on this.


You need to be a lot more specific.

The extent of the changes are: Someone changed a C file that only
effects one of the executables. Also 2 or 3 defines were added in the
middle of the h file and couple of lines down 2 function prototypes
were added. Now I compiled all the programs with the new header. But
on the machine where all the programs are running ... I only replaced
the program that was effected by a change in the C file. I did not
replace all the older version of the programs with the newly compiled
version. So one of the newly compiled executables is running with the
older executables.
In the case that this is not the right place to post this question,
can somebody suggest a different group


Gordon L. Burditt

Nov 13 '05 #4

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

Similar topics

1
1821
by: Tim Marsden | last post by:
Hi, How do I modify the app.config file for my application during install. The file is not available when using a helper class or custom action program until after the install? Tim
0
2718
by: John | last post by:
Hi, I am trying to get a file with extension .xxx to open as an MDI child inside an application (ABC.exe), which I created. I made a file association so that it will open with ABC.exe, but instead of opening it as an MDI child of an existing ABC.exe, it opens it in a whole new ABC.exe. An example of this would be similiar to when you...
5
2876
by: Nadav | last post by:
Hi, Introduction: ************************************************************ I am working on a project that should encrypt PE files ( Portable executable ), this require me to inject some code to existing PEs. First, I have tried: 1. to inject some code to the end of the ‘.text’ segment of an existing PE 2. to set the entry point...
1
966
by: Kenneth Keeley | last post by:
Hi, I wish to have a page that displays to a user an address book that is stored in an XML file. This part I have done with a Datagrid. I also wish the users to be able to click on an entry and g to a new page that then displays the full details for just that address and allows the user to edit the enter and store changes. My questions...
1
1550
by: tony | last post by:
Hello!! Normally I use C# but we have a project that is creating a window control library DLL that is done in C++.NET and that is here I have some problems that I want to solve. To be able to understand my question fully, I do the following. 1. Create a project that is a WindowControlLibrary called Test in C++.NET in this project we...
13
2089
by: Stephen Kay | last post by:
Is there a way to redirect every single page on an existing web site through a php function? In other words, say I have a whole functional HTML web site, never written to use any php. Now I would like to have a php function handle displaying every page, for example, instead of: http://www.mysite.com/mypage.html you would call:
2
1496
by: Bill Nguyen | last post by:
The HTML doc looks like this: <HTML xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> <HEAD> <META NAME="Generator" CONTENT="Microsoft MapPoint 2004">
1
1259
by: Cdude | last post by:
I need to add headers to a existing xls file.Then after that i can update my dataset into the xls file.Can you explain how i could do this.
0
1279
by: VVhiteCloud | last post by:
Hello how is everyone :D I would like to ask on how to modify a .dll file that i am using for wolfteam it is a fps game.....this .dll file is called UH.dll it doesnt come with the game download or anything else it is something i bought from a online company that gives advantages to players that buy this product....the thing is the guy kinda of...
0
7893
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. ...
1
7645
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7953
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...
0
6263
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...
1
5485
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...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2085
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1202
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.