3 ms·
Writing architecture-agnostic C++ or C code is mostly just a matter of avoiding some silly tricks which you shouldn't be doing anyway, and using the correct typ
by TillE 13y ago
Writing architecture-agnostic C++ or C code is mostly just a matter of avoiding some silly tricks which you shouldn't be doing anyway, and using the correct types and sizeofs.
Porting an operating system is hard. Porting a compiler is hard. But most applications on top of those are fairly straightforward to port, if not completely trivial.
- Theodores 13y agoWe have kind of forgotten this. Anyone old enough to remember the early browsers - Mosaic and Netscape - will remember how every platform was supported, regardless of CPU (including MIPS, SPARC, Alpha etc.) and regardless of OS (IRIX, AIX, System whatever, VMS, Windows, etc.). Furthermore you didn't have to wait two years for the non-Windows version to be updated. Only when Microsoft made NT Intel only did you get this arrangement where software was locked to a given architecture/OS. Thank goodness Linux came along.
- thrownaway2424 13y agoIt's possible but not trivial. If a programmer has never been exposed to any memory model other than the Intel PC model, they are in for big surprises when they start using POWER. When will write from thread A be visible to thread B? Can this atomic load pass that other load? For multithreaded C++ programs these are tricky. For other languages that always communicate between threads using messages, maybe not, but also maybe you're favorite language runtime doesn't exist on POWER.
- mikeash 13y agoThey're only tricky if you're communicating data between threads without using locks. Since this has always been a "here be dragons" area even with x86's convenient memory model, code that gets it right for x86 but not other architectures is pretty rare.