473,325 Members | 2,860 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,325 software developers and data experts.

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 2027
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***********@sneaky.lerctr.org (Gordon Burditt) wrote in message news:<bm********@library1.airnews.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
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
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...
5
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...
1
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...
1
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...
13
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...
2
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
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
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.