9- separate files, independent compilation, header files Flashcards

1
Q

Executable statements

A

some corresponding machine code is generated by the compiler
example: assignment statements, looping/branching constructs, function invocations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Non-executable statement

A

no machine code generated
example: function prototypes, variable and constant declarations, #include directives

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

include directives

A

tell the compiler to include specified file. The files included are called include or header files and have extensions .hpp
two forms:
#include <filename> - file is found in standard system-dependent location
#include ”filename.hpp” - file is found in the same directory as the rest of the code
purpose of include files: centralize declarations</filename>

include files may also contain include directives
what to put in include files: non-executable statements
what not to put in include files: executable statements, function definitions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Symbol table

A

which function code the file contains

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

External references

A

which functions the file uses but whose code is missing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

entry point

A

function where the execution starts – main()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

linker

A

locates the object file with the entry point
adds to executable
examines external references of this object file
for each external reference, searches other files/libraries’ symbol tables to find required function
when located, adds to executable
continues this process for other files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Preprocessor directive

A

starts with hastag symbol #, cause compiler to do manipulation of source file before compilation
#include is a preprocessor directive ‘
not a C++ statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

define [name value]

A

value textual substitution of name by value
seldom used for primary purpose
do not use #define instead of global constants
problem: #define press 50+5
int myvar = press * 20; // changes order of operations
value may be skipped: #define BIG_NAME

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

ifdef [name]

A

true if name defined

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

ifndef [name]

A
  • true if not
    this text is included in compiler processing if true, skipped otherwise
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

endif

A

completes #if

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Include guards

A

preprocessor directives used for multiple inclusion protection

How well did you know this?
1
Not at all
2
3
4
5
Perfectly