-
Notifications
You must be signed in to change notification settings - Fork 60
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
include headers: stdexcept && cstdint #152
Conversation
Add #include <stdexcept> Line 103: throw std::runtime_error("Arena: invalid or double free"); Line 328: throw std::runtime_error("LockedPool: invalid address not pointing to any arena");
Include the <cstdint> header for uint32_t
Include the <cstdint> header for uint32_t Line 92: const std::array<uint8_t, PREFIX_LEN>& prefix)
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.
Adding includes
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.
cACK
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.
Why is this being added? What exactly is this fixing @Jongjan88? |
I added it because I'm 100% sure they're missing.
ChatGPT: Portability Issues: Code that compiles on one system or with one compiler despite missing headers might fail to compile on a different system or with a different compiler. This lack of portability can cause complications when trying to share or deploy code across various environments. |
Necessary to access specific functionalities within C++ that can help with both error correction and portability. |
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.
ACK. It compiles, builds and runs for me. I see no harm in adding more headers. My question is was there a specific build issue this was solving? Or client behavior its fixing?
Missing headers? #include stdexcept && #include cstdint
#Chatgpt: Lockedpool.cpp
To use std::runtime_error in C++, you'll need to include the stdexcept header. This header provides the standard exception class std::runtime_error
#Chatgpt: bip32.h && string.h
The array header provides the functionality for the std::array container, which is a fixed-size array-like structure with some additional features compared to C-style arrays. The cstdint header includes definitions for fixed-size integer types, and uint8_t specifically refers to an unsigned 8-bit integer type.
#Bitcoin files
https://github.com/bitcoin/bitcoin/blob/master/src/support/lockedpool.cpp
Line 23: #include stdexcept
https://github.com/bitcoin/bitcoin/blob/master/src/util/bip32.h
line 8: #include cstdint
https://github.com/bitcoin/bitcoin/blob/master/src/util/string.h
Line 11: #include cstdint