Topic: string: :data vs. string::operator char*
Author: Kalyan Kolachala <kal@chromatic.com>
Date: 1995/05/01 Raw View
tim_boemker@zacatecas.optimum.com (Tim Boemker) wrote:
>Other than this (keeping a pointer into a temporary which has
been
>destroyed), are there any other pitfalls?
If the string is reference counted then the pointer could
be invalid if the string gets modified.
- Kalyan
Author: tim_boemker@zacatecas.optimum.com (Tim Boemker)
Date: 1995/05/01 Raw View
In article <9512116.20937@mulga.cs.mu.OZ.AU>
fjh@munta.cs.mu.OZ.AU (Fergus Henderson) writes:
> It's to make it harder for programmers to make mistakes like the
> following:
>
> string foo() {
> return "Hello World";
> }
> int main() {
> const char *s = foo();
> puts(s);
> return 0;
> }
Other than this (keeping a pointer into a temporary which has been
destroyed), are there any other pitfalls?
Tim Boemker
Optimum Group
(513) 577-7785