|
Posted by Jerry Stuckle on 09/30/07 17:55
Summercool wrote:
> 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.
>
You need to get more C++ books :-). You generally won't find them in
basic books, but some of the more advanced ones talk about function
signatures.
A C++ function's signature is dependent on the function name, number of
parameters being passed, and the type of each parameter. This is passed
onto the linker. In any C++ program, every function signature must be
unique.
But in this case he's a little incorrect. You *could* look at the
function's signature, but it's much easier just to look at the
function's declaration.
> 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.
>
>
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|