emu48 now for android-OS
|
04-04-2019, 01:05 PM
Post: #24
|
|||
|
|||
RE: emu48 now for android-OS
(04-04-2019 12:16 PM)ijabbott Wrote: I wonder why BOOL was defined as signed char for the Android build? If it was for iOS I could maybe understand it. To save space? Using a 32-bit type of which you're only using one bit is rather wasteful. Using an 8-bit quantity is still wasteful, but a common compromise since it's usually the smallest addressable unit. In early C, there was no dedicated Boolean type, so they used int instead, with the convention of saying 0 = false and 1 = true (or any nonzero value). This convention survived for a long time, because it took so long before C adopted bool -- I think bool only became an official part of C in the C99 standard. In Free42 I used int for bool originally for that exact reason. When I changed the project from C to C++, I started using bool instead of int where appropriate, but mostly in new code, leaving old code alone. Replacing int with bool made data structures more compact, but it also caused compatibility headaches where data structures are persistent, i.e. in the state file. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)