Next: High Integrity CPP Rule 17.13  Up: 17 Standard Template Library (STL)  Previous: High Integrity CPP Rule 17.11  Contents

High Integrity CPP Rule 17.12   Only use STL string's member c_str to get a const char* to use with legacy functions.

Justification

The c_str method is defined to return a valid, null terminated C style string. Other methods of getting a C style representation are implementation defined and not portable.

Reference

Effective STL Item 16;


HICPP VERSION 2.4  http://www.codingstandard.com   Copyright: © 2007 THE PROGRAMMING RESEARCH GROUP