News for hackers. Stuff that matters.
Re:Writing a C compiler in 500 lines of Python by circuit10 on Tuesday September 05, 2023 @05:53AM (#37389781)
If you’re writing code for those why not just use the smaller data types if you don’t need bigger ones? That way it will work efficiently on both and the behaviour will be consistent
Re:Writing a C compiler in 500 lines of Python by foldr on Tuesday September 05, 2023 @06:58AM (#37390146)
Fair point. I guess the issue is with library code that uses int. But you aren't typically going to use lots of general-purpose library code if you're targeting a microcontroller.
Re:Writing a C compiler in 500 lines of Python by circuit10 on Tuesday September 05, 2023 @11:31AM (#37393064)
If that library code doesn’t use the smaller types then it probably isn’t designed for those platforms, which means it won’t be tested with the smaller int types and they will likely cause lots of bugs. The one advantage I do see is that it might avoid extra sign extension instructions on some architectures when working with less than the native size, but there’s int_fast16_t for that