-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
memory-layout/memory-operations-and-GDB: Add reading and tasks #5
Conversation
a9d2877
to
8d5858d
Compare
8d5858d
to
2564766
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only gave a bird's eye view on this PR. I'll look into more depth and check the content more thoroughly after you address my high-level comments. In addition to my inline comments, do the following:
- Go through the linter errors and fix them [1] and especially [2].
- Add the following line at the end of each exercise: "If you're having difficulties solving this exercise, go through [this](link to a relevant reading section) reading material"
- Translate all code comments to English and use convert them to C-style:
/* ... */
or/** ... */
for multiline comments.
[1] https://github.com/cs-pub-ro/hardware-software-interface/actions/runs/8125357327/job/22207876189?pr=5
[2] https://github.com/cs-pub-ro/hardware-software-interface/actions/runs/8125357327/job/22207876129?pr=5
chapters/memory-layout/introduction-to-GDB/drills/tasks/inspect/README.md
Outdated
Show resolved
Hide resolved
chapters/memory-layout/introduction-to-GDB/drills/tasks/inspect/README.md
Outdated
Show resolved
Hide resolved
chapters/memory-layout/introduction-to-GDB/drills/tasks/segfault/support/.gitignore
Outdated
Show resolved
Hide resolved
chapters/memory-layout/introduction-to-GDB/drills/tasks/inspect/support/inspect.c
Outdated
Show resolved
Hide resolved
chapters/memory-layout/introduction-to-GDB/drills/tasks/inspect/README.md
Outdated
Show resolved
Hide resolved
chapters/memory-layout/memory-operations/drills/tasks/pixels/solution/pixel.h
Outdated
Show resolved
Hide resolved
chapters/memory-layout/memory-operations/drills/tasks/pixels/solution/pixel.h
Outdated
Show resolved
Hide resolved
chapters/memory-layout/memory-operations/drills/tasks/pixels/solution/pixels.c
Outdated
Show resolved
Hide resolved
chapters/memory-layout/memory-operations/drills/tasks/pixels/solution/pixel.h
Show resolved
Hide resolved
chapters/memory-layout/memory-operations/drills/tasks/pixels/support/pixel.h
Show resolved
Hide resolved
c687bf4
to
25f4c47
Compare
Still need to add advice for each problem, I'll come back to this later. Everything else is done (I think). |
chapters/memory-layout/introduction-to-GDB/drills/tasks/inspect/support/.gitignore
Show resolved
Hide resolved
chapters/memory-layout/introduction-to-GDB/guides/segfault/README.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this exercise I would suggest restricting the use of functions from string.h
, we should teach them about memcpy
and memcmp
here, since they're gonna be working with them exclusively in the homework anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, I'll look into doing this tonight.
25f4c47
to
348a597
Compare
348a597
to
fbf16df
Compare
I added all the proposed changes except the rework of the As I see it we'd probably need to add another subsection to the reading page that describes the memcmp, memcpy, etc. functions, making the already long reading section even longer. Thoughts? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking much better than before. I only made some cosmetic comments to make super-linter pass [1]. The checkpatch failure is a false positive, so don't worry about it. The spellcheck failure should be fixed when you git push -f
since I added the missing words to the wordlist [2].
[1] https://github.com/cs-pub-ro/hardware-software-interface/actions/runs/8131747551/job/22221428017?pr=5#step:3:698
[2] open-education-hub/actions#44
Implement the functions [memcpy](http://www.cplusplus.com/reference/cstring/memcpy/), [strcpy](http://www.cplusplus.com/reference/cstring/strcpy/), and [strcmp](http://www.cplusplus.com/reference/cstring/strcmp/) using pointer operations. | ||
|
||
If you're having difficulties solving this exercise, go through [this](../../../reading/README.md#pointer-operations-and-pointer-arithmetic) reading material. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 2 blank lines here, that's the problem.
|
||
for (int i = 0; i < height; ++i) | ||
for (int j = 0; j < width; ++j) | ||
pix_array[i][j] = generate_pixel(rand() % 256, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pix_array[i][j] = generate_pixel(rand() % 256, | |
pix_array[i][j] = generate_pixel(rand() % 256, |
Use rand_r()
instead of rand()
as suggested by super-linter: https://github.com/cs-pub-ro/hardware-software-interface/actions/runs/8131747551/job/22221428017?pr=5#step:3:698
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace rand()
with rand_r()
.
fbf16df
to
0c63857
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You forgot to address 2 of my previous comments. Maybe you forgot to git add
those files?
Implement the functions [memcpy](http://www.cplusplus.com/reference/cstring/memcpy/), [strcpy](http://www.cplusplus.com/reference/cstring/strcpy/), and [strcmp](http://www.cplusplus.com/reference/cstring/strcmp/) using pointer operations. | ||
|
||
If you're having difficulties solving this exercise, go through [this](../../../reading/README.md#pointer-operations-and-pointer-arithmetic) reading material. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 2 blank lines here, that's the problem.
|
||
for (int i = 0; i < height; ++i) | ||
for (int j = 0; j < width; ++j) | ||
pix_array[i][j] = generate_pixel(rand() % 256, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace rand()
with rand_r()
.
0c63857
to
56be8d7
Compare
Yep :))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for overlooking this earlier, but demos/array-vs-pointer
should be guides/array-vs-pointer
, just like segfault/
.
chapters/memory-layout/memory-operations/demos/array-vs-pointer/array_vs_pointer.c
Outdated
Show resolved
Hide resolved
56be8d7
to
71d8c74
Compare
Add reading and tasks for lab 2 and modify config.yaml to render the new content. Signed-off-by: Adrian-George Dumitrache <[email protected]>
71d8c74
to
f7f1578
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's OK
Prerequisite Checklist
Description of changes
Add reading and tasks for lab 2 and modify config.yaml to render the new content.