jason's blog

Crossplatform C++: Part 1: Intro

This is the first in a series of articles on writing crossplatform applications with C++. These articles will be based on the premise that strict adherence to standard C++ will result in extremely portable code which will run on almost every platform available, including embedded systems.

However, limiting yourself to strict C++ also means limiting yourself to the standard C++ libraries, which only cover basic file and console input and output. That means no graphical user interfaces.

Pass By Iterator

Pass by iterator is not a new concept, but one that we are going to perhaps give a new name to today and propose as a standard for normal usage.

If you take for example the normal way of passing around standard containers:

// Print a vector of strings separated by spaces.
void print(const std::vector<std::string> &t_vector)
{
  for(std::vector<std::string>::const_iterator itr = t_vector.begin();
        itr != t_vector.end();
        ++itr)
  {
    std::cout << *itr << " ";
  }      
}

std::vector<std::string> m_vec;
m_vec.push_back("Hello");
m_vec.push_back("World");
print(m_vec);

The idea of "Pass By Iterator" that we are proposing involves never again writing code like the above.

Ex Astris Release 2008-05-17 Available

Ex Astris 2008-05-15 snapshot is now available.

The economy was corrected from the previous release. A simple supply/demand model is used for determining the value of goods and the price is then negotiated based on the player's "Negotiation" skill.

Also, there are Ubuntu and MacOS binaries available for download with this release.

Ex Astris Release 2008-05-15 Available

Ex Astris 2008-05-15 snapshot is now available.

There are many changes to the organization of the code to make it a little more maintainable as well as basic game play features added including warping between planets and buying and selling of goods and refueling your vehicle.

Top 5 Myths About C++

We've now completed 5 articles in the "Nobody Understands C++" series so here we are going to recap the misconceptions we have covered.

  1. You shouldn't use all the language features of C++, that just makes your code too complicated! Wrong, we learned that by using some of the less used features of C++ we can make our code much more succinct.

Nobody Understands C++: Part 5: Template Code Bloat

On occasion you will read or hear someone talking about C++ templates causing code bloat. I was thinking about it the other day and thought to myself, "self, if the code does exactly the same thing then the compiled code cannot really be any bigger, can it?"

Here are the test cases presented, first without the use of templates, second with the use of templates. Exactly the same functionality and exactly the same code output:

Syndicate content