Skip to content

Commit 005e3bb

Browse files
committed
minor fixes in module 2
* make SizeOf and SizeOfPointers theory tasks * custom name for FunctionPointers task Signed-off-by: Evgenii Moiseenko <evg.moiseenko94@gmail.com>
1 parent d9cae8d commit 005e3bb

File tree

11 files changed

+21
-134
lines changed

11 files changed

+21
-134
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
type: edu
2+
custom_name: Function Pointers
23
files:
34
- name: CMakeLists.txt
45
visible: false
5-
- name: test/test.cpp
6-
visible: false
76
- name: src/task.cpp
87
visible: true
98
placeholders:
109
- offset: 90
1110
length: 109
1211
placeholder_text: return 0;
12+
- name: test/test.cpp
13+
visible: false

MemoryManagement/MemoryLayout/SizeOf/CMakeLists.txt

-13
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,10 @@ project(MemoryManagement-MemoryLayout-SizeOf)
44

55
set(CMAKE_CXX_STANDARD 14)
66

7-
set(OUTPUT_CPP_TASK MemoryManagement-MemoryLayout-SizeOf-output-cpp)
8-
set(OUTPUT_TXT_TASK MemoryManagement-MemoryLayout-SizeOf-output-txt)
9-
10-
# custom command to produce output.txt file, because its content
11-
# is platform-specific and need to be generated on student's machine
12-
add_executable(${OUTPUT_CPP_TASK} test/output.cpp)
13-
add_custom_target(${OUTPUT_TXT_TASK}
14-
COMMAND ${OUTPUT_CPP_TASK} ${CMAKE_CURRENT_SOURCE_DIR}/test/output.txt
15-
DEPENDS ${OUTPUT_CPP_TASK}
16-
)
17-
187
# Files from `./src` directory
198
set(SRC
209
src/main.cpp)
2110

22-
2311
# Running learner side code
2412
# Use PROJECT_NAME dependent names of targets for the plugin support to work correctly.
2513
add_executable(${PROJECT_NAME}-run ${SRC})
26-
add_dependencies(${PROJECT_NAME}-run ${OUTPUT_TXT_TASK})
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
1-
type: output
1+
type: theory
22
files:
33
- name: CMakeLists.txt
44
visible: false
5-
- name: test/output.txt
6-
visible: false
7-
- name: test/output.cpp
8-
visible: false
95
- name: src/main.cpp
106
visible: true
11-
placeholders:
12-
- offset: 53
13-
length: 788
14-
placeholder_text: /* TODO */

MemoryManagement/MemoryLayout/SizeOf/task.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ in modern computer architectures.
6161
Below, you can find a table containing the information about common predefined types:
6262
whether their size is platform dependent, what their exact or typical size is,
6363
and what value range they encode.
64-
In order to complete this task, print the sizes of these types to the terminal
65-
(in the same order as they appear in the table, each number on its own line).
66-
Check if the printed numbers match their counterparts in the table.
67-
64+
You can also run the program attached to this step to print
65+
the sizes of these types to the terminal.
66+
Therefore, you can check whether the sizes of these types on your system
67+
match the numbers given in the table.
6868

6969
| Type | Description | Platform Dependent? | Size* | Value Range |
7070
|-----------------|------------------------------------------------------------|---------------------|-------|--------------------|
@@ -87,9 +87,8 @@ Check if the printed numbers match their counterparts in the table.
8787
| `bool` | boolean values | Yes | 1 | false, true |
8888

8989

90-
91-
*Size is given in bytes, for platform-independent types exact size is given,
92-
for platform-dependent types typical size is given.
90+
*Size is given in bytes, for platform-independent types the exact size is given,
91+
for platform-dependent types the typical size is given.
9392

9493

9594

MemoryManagement/MemoryLayout/SizeOf/test/output.cpp

-34
This file was deleted.

MemoryManagement/MemoryLayout/SizeOf/test/output.txt

-16
This file was deleted.

MemoryManagement/MemoryLayout/SizeOfPointer/CMakeLists.txt

+1-13
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,11 @@ project(MemoryManagement-MemoryLayout-SizeOfPointer)
44

55
set(CMAKE_CXX_STANDARD 14)
66

7-
set(OUTPUT_CPP_TASK MemoryManagement-MemoryLayout-SizeOfPointers-output-cpp)
8-
set(OUTPUT_TXT_TASK MemoryManagement-MemoryLayout-SizeOfPointers-output-txt)
9-
10-
# custom command to produce output.txt file, because its content
11-
# is platform-specific and need to be generated on student's machine
12-
add_executable(${OUTPUT_CPP_TASK} test/output.cpp)
13-
add_custom_target(${OUTPUT_TXT_TASK}
14-
COMMAND ${OUTPUT_CPP_TASK} ${CMAKE_CURRENT_SOURCE_DIR}/test/output.txt
15-
DEPENDS ${OUTPUT_CPP_TASK}
16-
)
17-
187
# Files from `./src` directory
198
set(SRC
209
src/main.cpp)
2110

22-
2311
# Running learner side code
2412
# Use PROJECT_NAME dependent names of targets for the plugin support to work correctly.
2513
add_executable(${PROJECT_NAME}-run ${SRC})
26-
add_dependencies(${PROJECT_NAME}-run ${OUTPUT_TXT_TASK})
14+
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
type: output
1+
type: theory
22
custom_name: SizeOf Pointers
33
files:
44
- name: CMakeLists.txt
55
visible: false
6-
- name: test/output.txt
7-
visible: false
8-
- name: test/output.cpp
9-
visible: false
106
- name: src/main.cpp
11-
visible: true
12-
placeholders:
13-
- offset: 38
14-
length: 135
15-
placeholder_text: /* TODO */
7+
visible: true

MemoryManagement/MemoryLayout/SizeOfPointer/task.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ meaning that its value range includes negative values.
2222
This is expected, since one can subtract a "bigger" pointer `q` from a "smaller" pointer `p`
2323
and get a negative number as the result.
2424

25-
In order to complete this task, print the sizes of the `char*`, `size_t`, and `ptrdiff_t` types to the terminal
26-
(in this order, each number on its own line).
25+
The program attached to this step prints the sizes of the `char*`, `size_t`, and `ptrdiff_t` types to the terminal.
2726

2827

29-
| Type | Description | Platform Dependent? | Size in bytes (exact or typical) | Signed/Unsigned |
30-
|-------------|-------------------------------------------|---------------------|----------------------------------|-----------------|
31-
| `char*` | pointer type | Yes | 4 (x32), 8 (x64) | - |
32-
| `size_t` | type to store size of types | Yes | 4 (x32), 8 (x64) | Unsigned |
33-
| `ptrdiff_t` | type to store difference between pointers | Yes | 4 (x32), 8 (x64) | Signed |
28+
| Type | Description | Platform Dependent? | Size* | Signed/Unsigned |
29+
|-------------|-------------------------------------------|---------------------|------------------|-----------------|
30+
| `char*` | pointer type | Yes | 4 (x32), 8 (x64) | - |
31+
| `size_t` | type to store size of types | Yes | 4 (x32), 8 (x64) | Unsigned |
32+
| `ptrdiff_t` | type to store difference between pointers | Yes | 4 (x32), 8 (x64) | Signed |
3433

3534

35+
*Size is given in bytes, for platform-independent types the exact size is given,
36+
for platform-dependent types the typical size is given.

MemoryManagement/MemoryLayout/SizeOfPointer/test/output.cpp

-20
This file was deleted.

MemoryManagement/MemoryLayout/SizeOfPointer/test/output.txt

-3
This file was deleted.

0 commit comments

Comments
 (0)