Vu Pham <> scribbled the following
on comp.lang.c:
> I think this problem relates to either c or c++ ( but I am not sure which
> one ) so I post to both of these news group. I am sorry if I did something
> wrong here.
> Is there any difference between these two declarations :
> 1.
> void * functionA( char * p, int s, int * e );
> and
> 2.
> typedef void * ( *functionA_t)( char * p, int s, int * e );
> functionA_t functionA();
Yes, there is. The first declares a function taking three arguments,
of types (char *), (int) and (int *), and returning a (void *).
The second declares a function taking an unspecified number of
arguments, and returning a pointer to a function that is declared as
in the first case.
That's a pretty fundamental difference.
> I thought they are the same, but I must be wrong somewhere. The function is
> compiled and linked into a .so file. For the first declarartion, nm(1)
> shows that name in the .so file, but not for the 2nd declaration.
They are not the same as all. Maybe that's why you are getting
different results.
Note that .so files and nm(1) are off-topic here.
> Each of these declaration is embraced by extern "C" { }. The implenetation
> file is a .cpp compiled with g++.
This smacks of C++, which is also off-topic here. But I can say that
the same I said above applies for C++, with one difference: replace
"an unspecified number of arguments" with "no arguments".
--
/-- Joona Palaste () ------------- Finland --------\
\--
http://www.helsinki.fi/~palaste --------------------- rules! --------/
"'I' is the most beautiful word in the world."
- John Nordberg