r/cprogramming • u/Fast-Form-7770 • Feb 20 '26
Books about porting programs?
Are there good books about porting c programs to work on different systems and architectures? The books suggested to me on google are about cross platform development, which appear to be directed at those starting a project as opposed to someone trying to revive legacy software for example
0
Upvotes
3
u/knouqs Feb 20 '26
I have ported programs to different systems and architectures. There are a few key things to remember about porting.
Good luck!
1
u/gm310509 Feb 20 '26
Do you have a specific scenario in mind.
When I've ported things before (not a C program), it has been a case of understanding the functions used on the origin system and working out how to do those things on the new one.
As a general rule, try to port then fix. Don't do bug fixes (or worse, enhancements) until you get it fully ported and accepted by whomever you are porting it for (unless it is just a personal project of course).
1
u/pjl1967 Feb 20 '26
In 2026, books on just C is a fairly niche market. A book specifically about porting C programs would be even more of a niche market and very likely not worth a publisher's time.
I'd also guess that a generic book on porting programs wouldn't have sufficient detail to be useful unlike, say, porting programs specifically to a Raspberry Pi. But I also can't imagine that such a book would be any longer that a a few to dozen or so pages — not really "book length."
1
u/knouqs Mar 18 '26 edited Mar 18 '26
Hello again! I have written a how-to on endianness for you -- it took me a while to get a big endian system as I don't work on them anymore in a professional setting. Have a look, if you are still interested.
https://github.com/knouqs/endianness
Please note that you will need to comment out the calls to `swap_byte_order_for_binary_data1` and `swap_byte_order_for_binary_data2` if you want to see the effects of reading inconsistent architectures. I spent months solving these sorts of problems as the company for which I worked converted its codebase from big endian to mixed endian. (The endianness.c source here is mixed endian as it supports both.)