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

Incorrect use of operator& in README.md #4

Open
a-p-jo opened this issue Jun 8, 2022 · 0 comments
Open

Incorrect use of operator& in README.md #4

a-p-jo opened this issue Jun 8, 2022 · 0 comments

Comments

@a-p-jo
Copy link

a-p-jo commented Jun 8, 2022

All over the README.md file, there is code like :

CharT *data() {
    return (m_capacity > buffer_size) ? m_data.ptr : &m_data.buffer;
}

Note that while the type of m_data.ptr is indeed CharT *, that of &m_data.buffer is CharT **, because the "name" of an array decays to a pointer to it's 0th element.

Either you want m_data.buffer or you want &m_data.buffer[0] (the latter seems be the idiom in some C++ code, for instance in A Tour of C++ By Bjarne himself).

I hope this error does not exist in the source code.

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

No branches or pull requests

1 participant