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

add pointers concept #741

Merged
merged 28 commits into from
Mar 1, 2022
Merged

add pointers concept #741

merged 28 commits into from
Mar 1, 2022

Conversation

bobahop
Copy link
Member

@bobahop bobahop commented Jan 17, 2022

Still very much a WIP.

Rough first draft. TODO: cover use of pointers for function parameters.
Just a stub for now
@bobahop bobahop changed the title Patch 2 pointers Jan 17, 2022
@bobahop bobahop changed the title pointers add pointers concept Jan 17, 2022
@bobahop
Copy link
Member Author

bobahop commented Feb 10, 2022

I haven't touched this in a while. I think it's ready for some critique.


Variables and constants store their value in a memory location.
That location in memory is known as the address of the variable or constant.

Copy link
Contributor

Choose a reason for hiding this comment

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

Worth mentioning that quite often addresses are displayed in hexadecimal format by convention?
Just a suggestion, not sure if this is needed or not.

concepts/pointers/about.md Outdated Show resolved Hide resolved
concepts/pointers/about.md Outdated Show resolved Hide resolved
concepts/pointers/about.md Outdated Show resolved Hide resolved
concepts/pointers/about.md Outdated Show resolved Hide resolved
concepts/pointers/about.md Outdated Show resolved Hide resolved
concepts/pointers/about.md Outdated Show resolved Hide resolved
concepts/pointers/about.md Outdated Show resolved Hide resolved
concepts/pointers/about.md Outdated Show resolved Hide resolved
concepts/pointers/about.md Outdated Show resolved Hide resolved
concepts/pointers/about.md Outdated Show resolved Hide resolved
@bobahop
Copy link
Member Author

bobahop commented Feb 11, 2022

@wolf99 , thank you very much for you exhaustive critique! I already committed almost all of your suggestions. I'll go back through it and smooth out indirection/dereferencing and backticking the types consistently. There is also the wording of the "two pointers" for me to look at, and removing the online compiler comment. And whatever else I'm not thinking of right now.

It occurs to me that I didn't cover freeing pointers in this, so perhaps a small section on that should be added?

@wolf99
Copy link
Contributor

wolf99 commented Feb 11, 2022

Thanks for adding the concepts, it's great to get any contribution!

On freeing pointers; Im not sure what you have in mind exactly but maybe that's more like freeing dynamically allocated memory than freeing a pointer? Although you could possibly explain something about setting pointers to NULL is the equivalent of "un-setting" a pointer, as it were;
it may be best to avoid mixing dynamic memory handling in here if at all possible.

@bobahop
Copy link
Member Author

bobahop commented Feb 11, 2022

@wolf99 I think you're right. That's probably why I didn't add that to begin with.

Tweaks for backticking types more consistently, regularizing the term for indirection operator, and some other minor fixes. There is a bit more left to do...
Tweaked the comments in the code example for Arrays and Pointers.
@bobahop
Copy link
Member Author

bobahop commented Feb 11, 2022

Latest commits failed "Fail with link errors". Didn't use hyperlinks in the text, so I don't know what this is referring to.

concepts/pointers/about.md Outdated Show resolved Hide resolved
concepts/pointers/about.md Outdated Show resolved Hide resolved
bobahop and others added 3 commits February 12, 2022 06:52
A couple of recent suggested changes.
@wolf99
Copy link
Contributor

wolf99 commented Feb 12, 2022

The links seem to be failing due to an unrelated link that refers to the website of the test framework that we use.
Looking at that link my browser tells me the website's TLS certificate is not valid, so it looks like a "Them" problem rather than an "Us" problem.
I'll raise an issue to fix this separately.
So for the purposes of this PR we can ignore it as an SEP.

@bobahop
Copy link
Member Author

bobahop commented Feb 12, 2022

Thanks very much! I just committed changes for the wording, and also the line breaks you suggested and then deleted. I liked the suggestion so I kept it.

First draft of Introduction.md. Based on About.md
@wolf99
Copy link
Contributor

wolf99 commented Feb 20, 2022

This looks good to me @bobahop .
If you'd like to move it from a draft to "Ready for Review" I can approve.

@wolf99
Copy link
Contributor

wolf99 commented Feb 20, 2022

Just had a thought: what about restrict ?

@bobahop bobahop marked this pull request as ready for review February 20, 2022 23:29
@bobahop
Copy link
Member Author

bobahop commented Feb 21, 2022

I'm not very familiar with restrict. I've heard of it. I think I've seen it in one solution, but haven't gotten around to assimilating it.

@wolf99
Copy link
Contributor

wolf99 commented Feb 28, 2022

Hey Bob,
As a solution to get this merged I suggest we go ahead as-is, but if you could open an issue to add restrict to this concept so that you or someone else could pick it up separately.
When creating that issue it would be good to link this PR in it also, to keep the context.

@wolf99 wolf99 merged commit 7caaaa6 into exercism:main Mar 1, 2022
@wolf99
Copy link
Contributor

wolf99 commented Mar 1, 2022

Woo, thanks Bob! 🚀

@bobahop bobahop deleted the patch-2 branch March 7, 2022 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants