Why c8?

Discussion about everything. New games, 3d math, development tips...
Post Reply
chronologicaldot
Competition winner
Posts: 684
Joined: Mon Sep 10, 2012 8:51 am

Why c8?

Post by chronologicaldot »

/rant/
What's the benefit?

typedef gint int
typedef eint gint
typedef fint eint
typedef hint gint

void getA( hint pEople );
/rant

irrlicht isn't nearly as messy as GTK. I tried digging through that just to find out what they were using for their unicode characters. I think I managed to trace it back to some unsigned integer datatype, but I don't recall which size. And notably, of course, they are using UTF-16 encoding, which means they get stuck with BOM.


All that said, what's the most messy typedef-ing you've ever had to work with?
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Why c8?

Post by CuteAlien »

Reason is pretty trivial. Types like int8_t didn't exist in the past and are still not necessarily available on all compilers. But when you work with binary data formats you need exact byte sizes. So you make a typedef and then adapt it on each platform to have the correct size.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
chronologicaldot
Competition winner
Posts: 684
Joined: Mon Sep 10, 2012 8:51 am

Re: Why c8?

Post by chronologicaldot »

-_-
It's just defined as char, regardless of the compiler and platform, despite everything else in irrConfig. That said, char obviously varies from platform to platform. But yeah, I get the idea. Someone who needs it could come along and define their own c8.

While initially I was alittle opposed to moving to c++ (primarily for compiler support, although looks like everyone's finally on top of things), I've found the idea of consistent datatype sizes more enticing.

Anyways... still...
What's the most messy typedef libs and such you've ever had to work with?
Post Reply