|
| 1 | +## Module name: topic name |
| 2 | + |
| 3 | +_Skeleton descriptions are typeset in italic text,_ |
| 4 | +_so please don't remove these descriptions when editing the topic._ |
| 5 | + |
| 6 | +### Overview |
| 7 | + |
| 8 | +_Provides a short natural language abstract of the module’s contents._ |
| 9 | +_Specifies the different levels of teaching._ |
| 10 | + |
| 11 | +------------------------------------------------------------------------ |
| 12 | +Level Objective |
| 13 | +----------------- ------------------------------------------------------ |
| 14 | +Foundational Including code through standard library headers |
| 15 | + |
| 16 | +Main Organize function and class declarations into reusable |
| 17 | + files for inclusion into others |
| 18 | + |
| 19 | +Advanced --- (inlining? templates? hygiene, such as using namespace?) |
| 20 | + |
| 21 | +------------------------------------------------------------------------ |
| 22 | + |
| 23 | +### Motivation |
| 24 | + |
| 25 | +_Why is this important?_ |
| 26 | +_Why do we want to learn/teach this topic?_ |
| 27 | + |
| 28 | +Understanding and using header files allows for common declarations to |
| 29 | +be used across multiple files without copying-and-pasting the text. Also, |
| 30 | +understanding headers allows re-use of most existing 3rd-party libraries, |
| 31 | +as well as the C++ standard library. |
| 32 | + |
| 33 | +### Topic introduction |
| 34 | + |
| 35 | +_Very brief introduction to the topic._ |
| 36 | + |
| 37 | +The contents of header files are injected into a source file to allow |
| 38 | +multiple distinct source files to share a single source of common |
| 39 | +declarations. |
| 40 | + |
| 41 | +### Foundational: Including code through standard library headers |
| 42 | + |
| 43 | +#### Background/Required Knowledge |
| 44 | + |
| 45 | +A student is able to: |
| 46 | + |
| 47 | +* Invoke the compiler on a single source file to build an executable |
| 48 | + |
| 49 | + |
| 50 | +#### Student outcomes |
| 51 | + |
| 52 | +_A list of things "a student should be able to" after the curriculum._ |
| 53 | +_The next word should be an action word and testable in an exam._ |
| 54 | +_Max 5 items._ |
| 55 | + |
| 56 | +A student should be able to: |
| 57 | + |
| 58 | +1. Include common standard library headers to get access to commonly used declarations |
| 59 | + |
| 60 | +#### Caveats |
| 61 | + |
| 62 | +_This section mentions subtle points to understand, like anything resulting in |
| 63 | +implementation-defined, unspecified, or undefined behavior._ |
| 64 | + |
| 65 | +#### Points to cover |
| 66 | + |
| 67 | +_This section lists important details for each point._ |
| 68 | + |
| 69 | +* Usage of standard library code requires inclusion of various header files |
| 70 | +* Give examples of various header files and when they may be needed for inclusion |
| 71 | +* Include links to reference materials for finding out what headers are used for various feature sets |
| 72 | + |
| 73 | +### Main: Organizing function and class declarations for reuse |
| 74 | + |
| 75 | +#### Background/Required Knowledge |
| 76 | + |
| 77 | +* All of the above. |
| 78 | +* Define a function and write a separate, matching, declaration |
| 79 | +* Distinguish between a declaration and a definition |
| 80 | +* Compile multiple translation units and link them together into a single executable |
| 81 | + |
| 82 | +#### Student outcomes |
| 83 | + |
| 84 | +A student should be able to: |
| 85 | + |
| 86 | +1. Create a declaration for an existing function, placed in a separate file |
| 87 | +2. Include a header within the same directory |
| 88 | +3. Include a header locatable within the compiler's include directories |
| 89 | +4. Explain the meaning of the one-definition rule and how it applies to headers |
| 90 | +5. Protect a header with include guards and explain why they are necessary |
| 91 | + |
| 92 | +#### Caveats |
| 93 | + |
| 94 | +* #pragma is useful, but not standardized and so may not be fully supported on all systems |
| 95 | +* Reusing the same include guards may cause confusion. Naming conventions based on file paths can help |
| 96 | +* Accidentally putting a definition in a header file may or may not introduce undefined behavior |
| 97 | +* Circular dependencies can cause confusion. Care should be taken in identifying such |
| 98 | +* |
| 99 | + |
| 100 | +#### Points to cover |
| 101 | + |
| 102 | +### Advanced |
| 103 | + |
| 104 | +_These are important topics that are not expected to be covered but provide |
| 105 | +guidance where one can continue to investigate this topic in more depth._ |
0 commit comments