??? 12/23/04 10:48 Read: times |
#83693 - on ANSI-ness and portability Responding to: ???'s previous message |
Let me tell a story.
One friend of mine, while doing his PhD, had to solve a set of Schroedinger equations for various boundary conditions (dealing with quantum wells in very thin semiconductor layers) - basically solving differential equations. He wrote the first version in matlab, it went very rapidly - dealing with matrices of complex numbers etc. is natural in matlab. However, it ran too slowly, taking hours and hours of calculations on a then-high-end 486 PC. He decided to rewrite it to C to speed it up; but he gained access to Apollo (HP) and Sun workstations (running Unix), so he rewrote the software by hand, very carefully, strictly obeying ANSI, debugging on the PC (as machine time on the workstations was very limited) (Borland C has an ANSI-only option) and also trying to optimize the algorithm for speed. When he went to the workstations, confident he would be able to run it very quickly (being ANSI), it even did not compile for the first time, and then giving bad results. It took a lot of labour to make it SUN-ANSI and Apollo-ANSI. So much about portability. Not to mention the peculiarities of a Keil-ANSI compiler. I should have posted this on the C.vs.asm thread, but maybe useful here, too. Jan Waclawek |