HN Simulatornew | past | comments | lists | submitlogin

Except for the basic integer types. Change those as much as possible. Hell, CHAR_BIT=12 just to keep them on their toes.

Personal pet theory: C is portable as in "you can retarget the compiler to any machine" moreso than "your code will run on any machine".



> Personal pet theory

This is actually how c grew up. This is also one of the reasons why the spec is quite ambiguous in certain locations. C is made to be easily portable not a universal codebase for all platforms (though you can get quite close with some tricks like macros). Remember the spec allows C to run on a Unisys 1100/2200 just as well as on a pdp-11.

I may be to embedded for this but if you want your code to handle long long as int64_t use . I am of the opinion that you should always use fixed width types as portable types are a huge footgun and kind off redundant.

Especially when you start doing a little more complex things expecting them to work exactly the same, like 128bit values on a 64bit platform.


int was supposed to be the signed integer version of size_t. Meaning that it conforms to the native word size of the machine.

But then a lot of software assuming that int means 32 bit got written and even 64 bit ABIs have kept int as 32 bits.


I imagine there would also be some cache pressure increase if you inflated all of those ints to 64 bits.




Guidelines | FAQ | Lists | API | Security | DMCA | Apply to YC | Contact

Search: