Page MenuHome

Replace Ghost integral types with standard fixed width integers.
ClosedPublic

Authored by Nicholas Rishel (nicholas_rishel) on Jun 16 2021, 4:38 AM.

Details

Summary

Also replace integer with bool in Ghost API when only used as boolean, and replace uint8* with char* in Ghost API when variable is a string.

Diff Detail

Repository
rB Blender
Branch
fixed_width_integers (branched from master)
Build Status
Buildable 15235
Build 15235: arc lint + arc unit

Event Timeline

Nicholas Rishel (nicholas_rishel) created this revision.

Some things that should be audited:

  • ints that should be bools done
  • int8_t* or uint8_t* which should be char* done

Buildbot to ensure this compiles for Linux/OSX.

I have to admit, ghost was written long long before my time, and I have honestly no idea why all those custom types were in there in the first place, so from a standards perspective replacing custom types with standard conformant types +1 from me, but i can't help wondering if i'm missing something crucial here

@Sergey Sharybin (sergey) / @Brecht Van Lommel (brecht) either of you available for a history lesson here?

Once upon a time...

I think the reason for the ghost-specific fixed types was mainly caused by compilers from back in the days not having stdint.h. It wasn't very pleasant experience to ensure fixed-width types for all compilers. Especially before rather recent (in Blender history scope) MSVC release.

Nowadays I'd say use stdint and standard fixed-width types. I don't see reason to re-define those in GHOST.

  • Replace Ghost integral types with standard fixed width integers.
  • Replace uint8* with char* in Ghost API when variable is a string.
  • Replace integer with bool in Ghost API when only used as boolean.

Any review should prioritize the second commit "Replace uint8* with char* in Ghost API when variable is a string." as it's the only bit that wasn't a direct find/replace.

Need to sort out X11 char* unsigned char* casting.

  • Replace Ghost integral types with standard fixed width integers.
  • Replace uint8* with char* in Ghost API when variable is a string.
  • Replace integer with bool in Ghost API when only used as boolean.
  • Fixup: linux types.
Ray Molenkamp (LazyDodo) resigned from this revision.Jul 3 2021, 9:15 PM

I love everything about this, but this is for someone from the core module to accept, they are tagged so they should see this.

  • Fixup char* and unsigned char* casting for Linux.
  • Rebase master.

Remaining build issues for Linux are resolved and clang formatting is applied; this is ready for review.

This revision is now accepted and ready to land.Jul 5 2021, 9:41 AM