Re: Compiling C++ modules

Joshua Hudson
2006-04-24T22:32:06Z

On 4/24/06, Martin Mares <mj@ucw.cz> wrote:
> Hello!
>
> > Oh, and yeah, a = b + c *is* more readable than
> >
> > a = malloc(strlen(b) + strlen(c));
> > strcpy(a,b);
> > strcat(a,c);
> >
> > and contains fewer bugs ;)
>
> Actually, it contains at least the bug you have made in your C example,
> that is forgetting that malloc() can fail. So can string addition, if
> allocated dynamically.
>
> Have a nice fortnight
The C++ code *still* contains fewer bugs. I didn't see the malloc() one, but
there is another.