[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Beaver-devel] str_replace_tokens
From: |
Leslie Polzer |
Subject: |
Re: [Beaver-devel] str_replace_tokens |
Date: |
Sat, 7 Jun 2003 08:13:26 +0200 |
On Fri, 06 Jun 2003 17:11:36 -0400
Michael Terry <address@hidden> wrote:
> Leslie Polzer wrote:
> >>The reason is so that I can write
> >>str_replace_tokens (&str, 'l', "hi");
> >>
> >>instead of
> >>str = str_replace_tokens (str, 'l', "hi");
> >
> > Huh? But it'd be possible alright to write
> >
> > str_replace_tokens (str, 'l', "hi");
> >
> > too, wouldn't it?
> > Of course only if the ** was a *.
>
> No, you couldn't. C passes things by value, so if you did it with one
> *, you would merely get a copy of the calling function's pointer. You
> wouldn't be able to change the actual calling function's pointer.
>
> Think of it like this: if you wanted to actually change the value of an
> int, you would use int *. Since we want to change the value of a gchar
> *, we use gchar **.
My bad, you're right of course. Thanks!
By the way, I have replace str_replace_tokens by a version that can
handle more than one character in obj.
Leslie
--
Current Main System: LFS Linux dreadnought 2.4.20 #18 Thu May 15 19:11:10 CEST
2003 i686
Random Religious Statement: I don't like Emacs - it's bloated and expects
disturbing control sequences.