Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Even native languages close to the metal (Ada, Pascal, Basic, ...) don't have any big issue switching processors, unless inline Assembly is used.

C and its derivatives (C++ and Objective-C) are the outliers thanks to implementation defined numeric types, the abuse in pointer tricks and casts.



> "native languages close to the metal ... BASIC"

WHAT?


A long time ago in a galaxy far, far away, there used to be lots Basic compilers for doing systems programming in Z80, 68000, VAX, 80x86 ....

In fact, they still exist for micro-controlers, https://www.mikroe.com/mikrobasic.


I once had to help port a large system written in Ada from SPARC/Solaris to x64/RHEL. The only issues we rant into were predominately related to the endian difference between the two architectures, and that was really only due to the fact that our code did a lot of low-level bit manipulation :)


I have a curious question. I am not a Ada Developer but I have two that work for me. Another retired in OCT 17 after successfully porting our project from Solaris to RHEL 6. He told me at that time that we could not go back and compile the code for a Solaris system even though we still have the Solaris box we originally compiled on. Are there any issues you can see preventing us from going back and compiling the code for Solaris?


And ARM is little endian in all currently deployed processors.

So about only pitfall is assembler, SIMD intrinsics and depending on undefined behaviour like arithmetic or not signed right shift. Oh and different thread safety guarantees. ARM is much more lax with loads and stores and will require locking and correct use of atomic operations.


a lot of compiler works to enable.. C spec mandates fixed width numerics afaik.. try imagining 64bit division using 32bit.


I don't need to imagine it, I started programming on Z80.

EDIT: Forgot to mention that C spec only specifies "at least X" sizes, there is no portability guarantee if the types from stdint.h aren't used.

http://en.cppreference.com/w/c/language/arithmetic_types


Reminds me of the time I had to program a Z80-based controller board. It came with a non-standard C Compiler where integers were 16-bits long. Of course, I didn't realize this at first (I suppose I could have read the documentation, but...), so I had to figure it out for myself while debugging :)

It was my first time programming C on something that wasn't a 32 bit CPU :)


well there is. if you used <= "at least" sizes.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: