Cadcorp is hiring C++ zealots. Interested? Check Martin Daly‘s today’s post.
Tag Archives: programmer
Portability poem
Number of OSGeo stack software written by C/C++ camp have to run on Microsoft Windows systems. I think I wouldn’t be dead wrong if said that most of hackers from OSGeo Community work on Unix systems (Linux, Mac OS X) but there is large number of users who work on Windows.
Conclusion? Portability. Google is bursting at the seams of the essays about how to write portable code in C or C++ language. I’d add a little poem to the collection.
Principles of Portability
- Obey the standards, because they are not just dumb rules.
- Make a list of compilers that must be supported. Learn about their differences.
- If possible, use GCC 4+ and Visual C++ 7.1+.
- Using old compilers? If possible, use C89 but avoid C99.
- Prefer GCC 4.3 and Visual C++ 8.0+, so you get C++0x support. C++0x “brings C++ more in line with the C99″ – Wikipedia, so portability is much easier.
- Write code in C or in C++, but do not write both at the same time.
- Avoid (direct) use of C POSIX Library.
- Never ever disable any warnings compiler throw. Fix them.
- Be pedantic. Compile in highest strict mode possible.
- If possible, do not use compiler-specific features.
- Do not make platform/architecture specific assumptions about memory addressing, memory layout, etc.
- First understand why, then cast the hack.
- Personal preferences are evil. Make decisions based on reasoning.
- (Re)Use good code that already exist. Boost C++ Libraries won’t bite you!
- KIMS (Keep it modular, stupid) and let modules to loose coupling but keep cohesion in architecture, design as well as in development cycle (releases, inter-modular dependencies).
Logic
My wife asked me: Buy sausages, if you’ll find eggs, buy 10. What happens next?
Option #1:
if eggs >= 10 then buy(sausages, eggs=10);
Option #2:
if sausages > 0 then buy(sausages);
if eggs >= 10 then buy(eggs, 10);
Option #3
buy(sausages);
if eggs >= 10 then buy(eggs, 10);
The 3rd option is dangerous one because it could end up with never-ending run in the city looking for sausages, never buying eggs and never coming back home.
…and more. Why?
Asking me to make shopping, my wife did not stick to the principles of valid inference and correct reasoning. That’s the reason why not everybody can be a programmer :-)
Geospatial bits on BoostCon’09
On the 3rd of May 2009, the best event dedicated to C++ programmers starts in Aspen, US. It is BoostCon’09. The conference gathers developers and users of Boost C++ Libraries.
This year the event brings some flavour of geospatial technologies. Barend Gehrels and Bruno Lalande – core developers – are presenting their Generic Geometry Library –
- a library for geometry and geography,
- being agnostic in coordinate space and dimensions,
- based on templates and static polymorphism,
- decoupling types from algorithms,
- applying (self)verification of specified requirements with use of concepts
uff. :-)