Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Interpreting some C code

Reply
Thread Tools

Interpreting some C code

 
 
Chris Saunders
Guest
Posts: n/a
 
      02-06-2004
I am attempting to write and interface from another language to
some C code. I am having some difficulty interpreting a declaration.

int (*SSL_CTX_get_verify_callback(SSL_CTX *ctx))(int,X509_STORE_CTX *);

Any help would be appreciated.

Regards
Chris Saunders
http://www.velocityreviews.com/forums/(E-Mail Removed)


 
Reply With Quote
 
 
 
 
Vijay Kumar R Zanvar
Guest
Posts: n/a
 
      02-06-2004

"Chris Saunders" <(E-Mail Removed)> wrote

> I am attempting to write and interface from another language to
> some C code. I am having some difficulty interpreting a declaration.
>
> int (*SSL_CTX_get_verify_callback(SSL_CTX *ctx))(int,X509_STORE_CTX *);
>
> Any help would be appreciated.
>
> Regards
> Chris Saunders
> (E-Mail Removed)
>


Read the statement as follows:

1. Find out the name of the identifier. It is:

SSL_CTX_get_verify_callback

2. See on it's right side. It has (SSL_CTX *ctx) on it's
right. An identifier followed by a left parantheses,
some declarations -- zero or more; and a right parantheses
is a declaration of a function. So,

" ... SSL_CTX_get_verify_callback is a function taking as
argument a pointer to SSL_CTX ..."

3. Now, look at it's left side. It has an asterisk on it's left;
a probable sign of either poiter to a function or a function
returning a poiter to _something_. But, before check that
the asterisk, stuffs of steps 1 and 2 are enclosed within
a parantheses? Yes, they are. So,

( *SSL_CTX_get_verify_callback ( SSL_CTX *ctx ) )

" ... SSL_CTX_get_verify_callback is a pointer to a function
which takes pointer to an object of type SSL_CTX ... "

4. Now, see on the right side of

( *SSL_CTX_get_verify_callback ( SSL_CTX *ctx ) )

We have again an argument list of a function! Repeat the steps
2 and 3 to find that:

"SSL_CTX_get_verify_callback is a pointer to a function which
takes a pointer to an object of type SSL_CTX as an argument;
and, it returns a pointer to function which takes an int, and
a pointer to an object of type X509_STORE_CTX and returns an
int."

Oh! What a pretty thing it is!

--
Vijay Kumar R Zanvar


 
Reply With Quote
 
 
 
 
Chris Saunders
Guest
Posts: n/a
 
      02-06-2004
My thanks to Vijay.

I used to program in C a lot, and probably once could once have
interpreted this fairly easily.

I'd forgotten what a pretty thing it is!!!

Regards
Chris Saunders
(E-Mail Removed)

"Vijay Kumar R Zanvar" <(E-Mail Removed)> wrote in message
news:bvvd4s$115ijv$(E-Mail Removed)-berlin.de...
>
> "Chris Saunders" <(E-Mail Removed)> wrote
>
> > I am attempting to write and interface from another language to
> > some C code. I am having some difficulty interpreting a declaration.
> >
> > int (*SSL_CTX_get_verify_callback(SSL_CTX *ctx))(int,X509_STORE_CTX *);
> >
> > Any help would be appreciated.
> >
> > Regards
> > Chris Saunders
> > (E-Mail Removed)
> >

>
> Read the statement as follows:
>
> 1. Find out the name of the identifier. It is:
>
> SSL_CTX_get_verify_callback
>
> 2. See on it's right side. It has (SSL_CTX *ctx) on it's
> right. An identifier followed by a left parantheses,
> some declarations -- zero or more; and a right parantheses
> is a declaration of a function. So,
>
> " ... SSL_CTX_get_verify_callback is a function taking as
> argument a pointer to SSL_CTX ..."
>
> 3. Now, look at it's left side. It has an asterisk on it's left;
> a probable sign of either poiter to a function or a function
> returning a poiter to _something_. But, before check that
> the asterisk, stuffs of steps 1 and 2 are enclosed within
> a parantheses? Yes, they are. So,
>
> ( *SSL_CTX_get_verify_callback ( SSL_CTX *ctx ) )
>
> " ... SSL_CTX_get_verify_callback is a pointer to a function
> which takes pointer to an object of type SSL_CTX ... "
>
> 4. Now, see on the right side of
>
> ( *SSL_CTX_get_verify_callback ( SSL_CTX *ctx ) )
>
> We have again an argument list of a function! Repeat the steps
> 2 and 3 to find that:
>
> "SSL_CTX_get_verify_callback is a pointer to a function which
> takes a pointer to an object of type SSL_CTX as an argument;
> and, it returns a pointer to function which takes an int, and
> a pointer to an object of type X509_STORE_CTX and returns an
> int."
>
> Oh! What a pretty thing it is!
>
> --
> Vijay Kumar R Zanvar
>
>



 
Reply With Quote
 
Vijay Kumar R Zanvar
Guest
Posts: n/a
 
      02-06-2004
[..]

I have made little mistakes. I am correcting them.

> 3. Now, look at it's left side. It has an asterisk on it's left;
> a probable sign of either poiter to a function or a function
> returning a poiter to _something_. But, before check that
> the asterisk, stuffs of steps 1 and 2 are enclosed within
> a parantheses? Yes, they are. So,
>
> ( *SSL_CTX_get_verify_callback ( SSL_CTX *ctx ) )
>
> " ... SSL_CTX_get_verify_callback is a pointer to a function
> which takes pointer to an object of type SSL_CTX ... "


" ... SSL_CTX_get_verify_callback is a function
which takes pointer to an object of type SSL_CTX ...
and returns a pointer to ... "
>
> 4. Now, see on the right side of
>
> ( *SSL_CTX_get_verify_callback ( SSL_CTX *ctx ) )
>
> We have again an argument list of a function! Repeat the steps
> 2 and 3 to find that:
>
> "SSL_CTX_get_verify_callback is a pointer to a function which
> takes a pointer to an object of type SSL_CTX as an argument;
> and, it returns a pointer to function which takes an int, and
> a pointer to an object of type X509_STORE_CTX and returns an
> int."
>


"SSL_CTX_get_verify_callback is function which takes a pointer
to an object of type SSL_CTX as an argument; and, it returns a
pointer to function which takes an int, and a pointer to an object
of type X509_STORE_CTX and returns an int."


> Oh! What a pretty thing it is!
>


Now, it's more prettier!

--
Vijay Kumar R Zanvar




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Interpreting JSP code yzzzzz Java 4 04-21-2005 08:51 AM
Interpreting mem_map init code zolli C Programming 4 03-28-2005 01:32 PM
? Need help interpreting this suspicious HTML code Alec S. HTML 5 09-11-2004 02:32 AM
Interpreting the error message? Rob Meade ASP .Net 2 01-28-2004 08:52 AM
Interpreting some code Chris Saunders C Programming 5 07-24-2003 09:20 AM



Advertisments