|
Posted by Summercool on 09/30/07 16:49
On Sep 30, 4:18 am, 7stud -- <dol...@excite.com> wrote:
> SpringFlowers AutumnMoon wrote:
> > we have no way
> > of knowing what we pass in could get changed.
>
> Sure you do. You look at the function's signature. In order to use
> someone else's library, you have to know the function's signature. And
> the signature explicitly tells you whether the value you pass in could
> be changed.
do you mean in C++? I tried to find signature in two C++ books and it
is not there. Google has a few results but it looks something like
prototype. Is signature the same as the function prototype in the .h
file? If so, don't we usually just include <___.h> and forget about
the rest. Documentation is fine although in some situation, the
descriptions is 2 lines, and notes and warnings are 4, 5 times that,
and the users' discussing it, holding different opinion is again 2, 3
times of that length. I think in Pascal and C, we can never have an
argument modified unless we explicitly allow it, by passing in the
pointer (address) of the argument.
also i think for string, it is a bit different because by default,
string is a pointer to char or the address of the first char in C and C
++. So it is like passing in the address already. it is when the
argument n is something like 1 that makes me wonder.
Navigation:
[Reply to this message]
|