coddding
coddding

Reputation: 343

Porting program, curious if int16_t & __int16 are 'the same'

So i am porting one of my programs to a new gaming console. The problem is that the SDK used to compile my c++ application doesn't support __int16, BUT it does have int16_t. Would it be 'safe' to use int16_t in replace of __int16?
Also, if im not mistaken could i just use unsigned short int for a 16 bit integer rather than using int16_t or __int16?

Upvotes: 1

Views: 992

Answers (2)

joelw
joelw

Reputation: 431

int16_t and __int16 should both be signed 16-bit integers. Substituting one for the other should be fine. unsigned short int is completely different. It is unsigned rather than signed and it isn't guaranteed to be 16 bits. It could end up being a different size.

Upvotes: 1

Malcolm McLean
Malcolm McLean

Reputation: 6404

They will be the same.

People used to define their own fixed width types before the standard ones came out. Just use a typedef - that's what they are for.

Upvotes: 1

Related Questions