home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
drdobbs
/
1991
/
10
/
config.asc
< prev
next >
Wrap
Text File
|
1991-09-10
|
2KB
|
83 lines
_OBJECT-ORIENTED SOFTWARE CONFIGURATION MANAGEMENT_
by Richard Harter
Example 1: The base version of a simple example program.
void main(int argc,char *argv[])
{
int sum,i;
for (i=0;i<argc;i++)
{
sum += atoi(argv[i]);
}
printf("Sum = %d\n",sum);
}
Example 2: Change A1 fixes a bug in initialization of a variable.
void main(int argc,char *argv[])
{
----> int sum = 0;
----> int i;
è
for (i=0;i<argc;i++)
{
sum += atoi(argv[i]);
}
printf("Sum = %d\n",sum);
}
Example 3. Change A2 is some compiler-dependent speed optimization.
void main(int argc,char *argv[])
{
----> register int sum = 0;
----> register int i;
----> for (i=argc; --i >=0; )
{
sum += atoi(argv[i]);
}
printf("Sum = %d\n",sum);
}
Example 4. Change B1 modifies the function of the program to sum squares.
void main(int argc,char *argv[])
{
int sum,i;
----> int k;
for (i=0;i<argc;i++)
{
----> k = atoi(argv[i]);
----> sum += k*k;
}
printf("Sum = %d\n",sum);
}
Example 5. Merge of path B with the first part of path A.
main(int argc, char *argv[])
{
----> int sum = 0;
----> int i;
int k;
for (i=0; i<argc; i++)
{
k = atoi(argv[i]);
sum += k*k;
}
printf("Sum = %d\n",sum);
è}