-
-
Notifications
You must be signed in to change notification settings - Fork 214
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
feat: add pointers concept #823
Conversation
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.
Pointers. Haiyaa.
It is difficult to make it short and interesting but not shallow.
Any suggestions?
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.
Not bad!
This whole documents describes pointers as "memory addresses". That is not wrong, at least on a practical level.
Formally (I think) neither the C++17 standard nor the C11 standard (which is part of the C++17 standard) define pointers in terms of "memory" but rather with "addresses" and "objects". Instead of defining what a pointer is they describe how you can derive it, when it is valid, how you can use it.
You could consider replacing many occurrences of "memory" in this PR with "objects", e.g. instead of "Pointers are a way to share memory" you could write "Pointers are a way to share objects". That would match the official terminology.
If you want to describe pointers as addresses in memory that's fine with me, just keep in mind that this is not in the official specification, and you cannot refer to some formal definition but have to describe it in your own words.
I'm missing a warning in the section about dynamic memory allocation that modern C++ code should use smart pointers (perhaps with a link to the other concept). I'd rather remove that whole section and put it into a different concept about dynamic memory allocation.
@siebenschlaefer, if you think this is good to merge now, I will add the about.md file and make configlet happy. |
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.
Looks good.
My new suggestions are mostly nitpicks, feel free to ignore or disregard them.
I moved the section about dynamic memory allocation to the |
I would put that concept after "references" and follow up with smart pointers. the trinity of confusion.
I think windowing system might be a fitting concept exercise.