O'Reilly logo

Imperfect C++ Practical Solutions for Real-Life Programming by Matthew Wilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 31. Return Value Lifetime

This chapter contains much of the material from a series of installments of Flexible C++, my C/C++ User's Journal Expert's Forum column [Wils2003d, Wils2003f, Wilson2004b]. It revolves around the seemingly trivial problem of converting integers to strings in an efficient manner.

As it turns out, it's anything but a trivial issue when the details start to come out, and as well as illustrating some practical ramifications of many of the issues covered in the book so far, it brings into sharp focus the issue of Return Value Lifetime (RVL) which we discussed in the section on Conversion Shims (see sections 16.2 and 20.5).

Probably the most common way to convert integers to strings is via sprintf(), whether called directly ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required