Portability Guidelines

From K-3D

Jump to: navigation, search

Coding

  • If you require fixed-size integers use the portable ones provided by the Boost library, e.g.
#include <boost/cstdint.hpp>
boost::uint32_t foo;
boost::int16_t bar;
  • Do not use <stdint.h>, which is part of the C99 standard but is not yet available on many platforms.
  • Do not use the __PRETTY_FUNCTION__ macro, which is gcc-specific. In general, we prefer that log output be clearly understandable without reference to specific locations in the code. If you still want to log a message that contains the source filename and line number, use the k3d_file_reference macro, e.g.
#include <k3dsdk/log.h>
k3d::log() << error << k3d_file_reference << ": could not locate foo!" << std::endl;
Personal tools