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

include headers: stdexcept && cstdint #152

Merged
merged 4 commits into from Dec 27, 2023
Merged

include headers: stdexcept && cstdint #152

merged 4 commits into from Dec 27, 2023

Conversation

ghost
Copy link

@ghost ghost commented Dec 26, 2023

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

Jan added 3 commits December 26, 2023 03:23
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)
Copy link

@chopperbrian chopperbrian left a comment

Choose a reason for hiding this comment

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

Adding includes

@ghost ghost changed the title include stdexcept And cstdint include headers: stdexcept && cstdint Dec 26, 2023
Copy link
Member

@gto90 gto90 left a comment

Choose a reason for hiding this comment

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

cACK

Copy link

@j50ng j50ng left a comment

Choose a reason for hiding this comment

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

@ycagel
Copy link
Member

ycagel commented Dec 26, 2023

Why is this being added? What exactly is this fixing @Jongjan88?

@ghost
Copy link
Author

ghost commented Dec 26, 2023

Why is this being added?

I added it because I'm 100% sure they're missing.

What exactly is this fixing @Jongjan88?

ChatGPT:
Undefined Behavior: Without the required header, your code might still compile, but it could exhibit undefined behavior. This means that the program might run unpredictably, leading to crashes, incorrect outputs, or other unexpected results.

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.

@JohnnyLawDGB
Copy link

Necessary to access specific functionalities within C++ that can help with both error correction and portability.

Copy link

@JaredTate JaredTate left a 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?

@ghost
Copy link
Author

ghost commented Dec 27, 2023

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?

Yes build errors on Ubuntu 23.10.1.

image

@JaredTate
Copy link

ACK.

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?

Yes build errors on Ubuntu 23.10.1.

image

Awesome! Thanks for this

@JaredTate JaredTate merged commit 1c2c656 into DigiByte-Core:develop Dec 27, 2023
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.

6 participants