<commit_before><commit_msg>lecture 02<commit_after>#   

### 
#####  
```c++
#include <file_name> //    
#include "file_name" //    
```

##### 
```c++
#define true false // happy debugging
#define true !!(rand() % 2)
```
```c++
#define BUF_SIZE 1024
```
  define   ,          .

######   ++
```c++
namespace options
{
    static const size_t BufSize = 1024;
    constexpr size_t BufSize = 1024;
}

std::array<char, options::BufSize> data;
```

#####  
```c++
#define DEBUG
#ifdef DEBUG
    ...
#else
    ...
#endif
```
```
g++ -DDEBUG ...
```

#####  
```c++
#ifdef BUF_SIZE
#error Rename the macros
#endif

#define BUF_SIZE 256

...

#undef BUF_SIZE
```

###  
   ,       .

```code.cpp```
```c++
#include <vector>

#include "code.h"

void someFunction()
{
    ...
}

...
```
>   code.cpp,         .

```
g++ o code.o c code.cpp
```
code.o   ,   (object file).

>         .

###  (linking)
         .

        ,                .

```
g++ -o my_app a.o b.o
```

 ld,  g++    .

#####   
1.    (undefined symbols)
2.       (multiple definition)

#####    
```c++
//buffer.h

namespace utils
{
    class Buffer
    {
         ...
    }
}
```
```c++
// text_processor.h
#include "buffer.h"

...
```
```c++
// main.cpp
#include "buffer.h"
#include "text_processor.h"
```
       `utils::Buffer`,     .
```c++
// buffer.h
#ifndef UTILS_BUFFER_H
#define UTILS_BUFFER_H

...

#endif
```
```c++
// buffer.h
#pragma once
```

#####  

```c++
// a.h
#include "b.h"

class A
{
    B* b;
};
```

```c++
// b.h
#include "a.h"

class B
{
};
```

#####   (forward declarations)

```c++
// a.h

class B;

class A
{
    B* b;
};
```

```c++
// a.cpp
#include "a.cpp"
```

```c++
// b.h
#include "a.h"

class B
{
};
```















{'fraction_non_alphanumeric': 0.256993006993007, 'fraction_numerical': 0.011655011655011656, 'mean_word_length': 2.0070052539404553, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5736741', 'n_tokens_mistral': 790, 'n_tokens_neox': 709, 'n_words': 152}