Compiler Idiosyncrasies

We support many compilers. GNU g++ on every supported platform (imperfectly on Windows) and Microsoft Visual Studio 6 and 7 (.NET) on Windows. Users have successfully compiled with Visual Studio 2005. Occasionally we run into something that a particular compiler doesn't like, although it's sometimes quite difficult to figure out exactly what it doesn't like. Anyway, here's a list of things to avoid, particularly if you're modifying the Syzygy libraries themselves:

  1. Avoid multiple loop-variable initializations, e.g:
      for (int i=0; i<N; ++i) {
        ...
      }
      for (int i=0; i<N; ++i) {
        ...
      }
    
    Visual C++ 6 will barf. Instead, use:
      int i;
      for (i=0; i<N; ++i) {
        ...
      }
      for (i=0; i<N; ++i) {
        ...
      }
    

  2. Avoid complicated stuff in constructors:
      string s("What's up, doc?");
    
    is fine, but Visual C++ 6 MAY have problems with
      DataStructure* s( functionReturningDataStructure() );
    
    Unless you're initializing something with a constant, it's probably better to use:
      DataStructure* s = functionReturningDataStructure();
    

  3. Be careful with the STL, especially STL algorithms: We have no idea why, but in one particular file a call to
      copy(_consumeStack.begin(), _consumeStack.end(), _storageStack.end());
    
    caused the application to crash when built with MinGW g++ (Windows), but
      list<pair<char*,int> >::iterator iter;
      for (iter = _consumeStack.begin(); iter != _consumeStack.end(); ++iter){
        _storageStack.push_back(*iter);
      }
    
    made it all better.