Forward Declarations And Compiling Multiple Files Flashcards

1
Q

Forward declaration

A

Tells the compiler about existence of identifier before defining an identifier

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

Function prototype

A

Declaration statement used to write a forward declaration, consists of function, return type, name, parameters, no body and (;)

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

Definition

A

Implements/instentiates the identifier

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

ODR

A

One definition rule

  • within a file, function, objec or template
  • within a program, an object or normal function
  • types, templates and inline functions can have identical deffinitions in different files
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Declaration

A

We use it when we want to use identifier before it is defined

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

Definitions

A

Are declarations in c++

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

Compiling files

A

Each file individualy, its limited visability and short memory is to have functions or variables that have same name without conflicting

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

To add new file

A

Right click source files in solution explorer and choose add, new file

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

Errors when working with multiple files

A
  • forgeting to forward declaration to functions
  • add.cpp is not added correctly
  • add.cpp is added to wrong project
  • file is set to not compile or link
  • do not #include add.cpp from main.cpp
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Naming collision

A

Error when 2 identical identifiers are introduced into the same program in a way where the compiler/linker can’t tell them apart

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

Occurence of naming collisions

A
  • when 2 or more deffinitions for functions are introduced into a seperate files that are compiled into the same program
  • when 2 or more definitions for functions are introduced into the same file
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Namespace

A

Region that allows you to declare names inside of it for the purpose of disambiguation, provides own namespace scope and must have unique names.

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

Global namespace

A

Any name that is not defined inside a class, function or namespace

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

:: (symbol)

A

Scope resolution operator, identifier to the left identifies the namespace where the name to the right is contained with

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