Skip to content
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

Merged
merged 1 commit into from
Mar 6, 2024

Conversation

dumitrache-adrian92
Copy link

Prerequisite Checklist

  • Read the contribution guidelines regarding submitting new changes to the project;
  • Tested your changes against relevant architectures and platforms;
  • Updated relevant documentation (if needed).

Description of changes

Add reading and tasks for lab 2 and modify config.yaml to render the new content.

@teodutu teodutu self-assigned this Mar 2, 2024
@dumitrache-adrian92 dumitrache-adrian92 added the needs-rendering The PR makes changes to the website that need to be rendered label Mar 2, 2024
Copy link

github-actions bot commented Mar 2, 2024

@dumitrache-adrian92 dumitrache-adrian92 added needs-rendering The PR makes changes to the website that need to be rendered and removed needs-rendering The PR makes changes to the website that need to be rendered labels Mar 2, 2024
Copy link

github-actions bot commented Mar 2, 2024

Copy link

@teodutu teodutu left a 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

@dumitrache-adrian92 dumitrache-adrian92 force-pushed the lab2-openedu branch 2 times, most recently from c687bf4 to 25f4c47 Compare March 3, 2024 00:09
@dumitrache-adrian92 dumitrache-adrian92 added needs-rendering The PR makes changes to the website that need to be rendered and removed needs-rendering The PR makes changes to the website that need to be rendered labels Mar 3, 2024
Copy link

github-actions bot commented Mar 3, 2024

@dumitrache-adrian92
Copy link
Author

Still need to add advice for each problem, I'll come back to this later. Everything else is done (I think).

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.

Copy link
Author

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.

@dumitrache-adrian92
Copy link
Author

I added all the proposed changes except the rework of the delete_first exercise proposed by Dave. I want to hear everyone's opinions on how it should be approached (and if everyone agrees with it).

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?

@dumitrache-adrian92 dumitrache-adrian92 added needs-rendering The PR makes changes to the website that need to be rendered and removed needs-rendering The PR makes changes to the website that need to be rendered labels Mar 3, 2024
Copy link

github-actions bot commented Mar 3, 2024

Copy link

@teodutu teodutu left a 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.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Copy link

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,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link

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().

Copy link

@teodutu teodutu left a 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.

Copy link

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,
Copy link

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().

@dumitrache-adrian92
Copy link
Author

You forgot to address 2 of my previous comments. Maybe you forgot to git add those files?

Yep :)))

Copy link

@teodutu teodutu left a 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/.

config.yaml Show resolved Hide resolved
Add reading and tasks for lab 2 and modify config.yaml to render the new
content.

Signed-off-by: Adrian-George Dumitrache <[email protected]>
@teodutu teodutu added needs-rendering The PR makes changes to the website that need to be rendered and removed needs-rendering The PR makes changes to the website that need to be rendered labels Mar 6, 2024
Copy link

github-actions bot commented Mar 6, 2024

Copy link

@teodutu teodutu left a 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

@teodutu teodutu merged commit 8576090 into cs-pub-ro:main Mar 6, 2024
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rendering The PR makes changes to the website that need to be rendered
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants