Portable Coding and Cross-Platform Libraries?
Bradee-oh! queries: "My brother and I were just commissioned to develop a large energy management system for a few big college campuses in the area. It will be written in C/C++. We know that in 6 months, when a preliminary test system will be installed, it will be running on NT/2000 servers. The software will be tested on NT for up to 12 months and a final version will run on NT a year after that. We also know that around that time, it will shift to *nix servers, and we're expected to account for that in development. The question is, what sorts of cross platform libraries will make this as painless as possible? I've never made it a point to code for 2 platforms at once in any language other that Java. Aside from the GUI, which we've already agreed to use QT 3.0 for, we specifically are looking for cross-platform libraries for multi-threading, serial port I/O, and network I/O."
"Ideal libraries would be open source and free, though those aren't as important as tested/stable/reliable. What are your recommendations? Anyone have experience writing for multiple platforms at once with threading, serial I/O, and network I/O all in mind? The ideal scenario would be to recompile on the new platform without changing a line of code - will this type of portability be possible?"
The GNU Compiler (gcc/g++) runs on so many platforms so it should solve a lot of portability issues. CommonC++ is a GNU library for threading and I also believe it can handle network IO.
Now, I always heard that NT is supposedly Posix compliant so it might not be terribly difficult...
int func(int a);
func((b += 3, b));
And I still don't get why those people who insist on Java programming cannot see how screwed up Java is. Just look at any of the well-known Java projects (JUnit, the Jakarta stuff) and watch how insane programming in Java is. "We don't have method pointers, so we use the method name and reflection". "We do not have preprocessors or macros, so we cut&paste the code and modify each copy a little bit". "We are too lazy to write the long static method invocations, so we just inherit from the class that contains the methods that we need". "Lets make everything a bean, use reflection to access it and separate the code in 5 layers - ok, we write 10 times the code of a simple solution, but look how easy it is to do this change"... I admit that C++ is harder to learn, just because of its pure size, but it really pays off because it contains so many features that are really make your life easier without using all the ugly cludges that the Java guys must do (unfortunately I am one of them and do this 8hrs/d).