Erik Wikström wrote:
> On 2007-09-30 18:49, 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?
> 
> A signature is what is required to identify a function and includes
> return type, name of function and the types of the parameters, while it
> looks just like a prototype it is not. A prototype is something you
> write to satisfy your compiler while a signature identifies a function.
> Below are some examples of signatures, only the last can modify the
> values of its parameter.
>

No, the function's signature does not include the return type.

>   void foo(int, float)
>   std::string bar(const std::string&, int, int)
>   void baz(std::string&)
> 

Actually, these are prototypes.  The signature is what's passed onto the 
linker - perhaps something like "?foo@@YAXHM@Z".  It's also generally 
compiler dependent for C++ mangled names.

Also, I should clarify - the C++ function signature includes parameter 
information.  The C function signature is only dependent on the function 
name and is almost always the name preceded by an underscore).

You can see the function signatures in a map file if you leave the names 
mangled.
.
>> 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.
> 
> Unless you read the documentation how do you know which files to
> include? And what documentation are you reading which does not clearly
> specify the functionality of the functions described?
>

Exactly.


-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex / attglobal.net
==================