Thursday, January 28, 2010

Today I am glad I understand the meaning of "ifndef .....". It is to prevent the compiling conflict .
#ifndef _344_BIOF_H
#define _344_BIOF_H
..........
......
#enddefine

At the first time,when we execute the code the _344_BIOF_H has not been defined, the code underneath will be executed. When it comes to the second time, since _344_BIOF_H has been defined, the following code will not be executed. In this way, we can prevent the code to be compiled for twice.

Actually, I had the problem when I did my oop244 assignment. I did not know exactly the reason at that time. Now I realize we need to put #ifndefine, #define, #enddefine to every blank header file.

No comments:

Post a Comment