CoreBitcoin icon indicating copy to clipboard operation
CoreBitcoin copied to clipboard

Revisit API to use NSInteger as much as possible

Open oleganza opened this issue 11 years ago • 3 comments

As Swift converts both NSUInteger and NSInteger in objc APIs to signed "Int" type and Chris Lattner provided well-versed argumentation in favor of a single int type, we should play along. Getting rid of unnecessary uint32_t and NSUInteger types in APIs would streamline API usage and reduce amount of compiler complaints.

Most important pieces to update: transaction output/input indexes and BIP32 indexes.

This issue is motivated by real-life usage of CoreBitcoin in a Bitcoin wallet application for iOS.

oleganza avatar Oct 28 '14 15:10 oleganza

Might moving away from uint32 possibly reduce the type safety of the code?

rsmoz avatar Jul 30 '15 00:07 rsmoz

@rsmoz i'm thinking of having explicit range validation and conversion in places where binary representation is important. In a Swift-like manner when out-of-range number safely crashes the program instead of silently truncating it.

oleganza avatar Jul 30 '15 06:07 oleganza