Schwab,Wilhelm K <bsch...@...> writes: > > Nicolas, > > I would read > > void (*CRYPTO_get_locking_callback)(int mode,int type,const > char *file,int line) > > as a pointer to a function taking four arguments and returning nothing. > That is _not_ what OpenSSL defines. With the added void argument, it looks to me like the callback takes no > arguments and returns nothing. > > I would expect what you described to look more like > > (void* (*CRYPTO_get_locking_callback)(int mode,int type,const > char *file,int line)) F(void); > > I prefer to "hide" function pointers using type definitions to make them clear. You mention a function > named F, but the given syntax does not name it. It does look like any prototype I have seen, and it's not a > typedef, unless that is happening implicitly?? > > Bill >
I introduced a named return value F just for trying to explain. F is the return value, so it is anonymous. This is a valid syntax for a function returning a pointer to a function. But of course my explanation was plain wrong... Sorry. I inverted the arguments... So here is a better explanation. 0) CRYPTO_get_locking_callback is the name of the function. It is not a typedef. 1) CRYPTO_get_locking_callback is a function taking no argument (void) 2) it returns a pointer to a function which 2.a) return nothing (void) 2.b) takes four arguments int mode,int type,const char *file,int line)) I can read C, but const and function pointer are ones I will fail to parse 50% of time... Feel like I must not be alone... This is C anyway... It's not that easy to speak to a dumb compiler, so that he finally understands how to optimize that code! And not to optimize that code is of course not an option... Nicolas > -----Original Message----- > From: pharo-project-boun...@... > [mailto:pharo-project-boun...@...] On Behalf > Of Nicolas Cellier > Sent: Tuesday, March 10, 2009 5:14 PM > To: pharo-proj...@... > Subject: Re: [Pharo-project] OpenSSL - a couple of questions > > Schwab,Wilhelm K <bsch...@...> writes: > > > > > Nicolas, > > > > Fair enough, but it's the rest of the expression that bothers me - what does > the second argument sequence do? > > > > Bill > > > > I'm not sure I understand the question, but i'll tell how I read this syntax: > > CRYPTO_get_locking_callback is a function taking four arguments > (int mode,int type,const char *file,int line). > > CRYPTO_get_locking_callback will return a pointer to a function, say F. > This function F does take no argument and return no result. > void F(void). > > Nicolas > > > -----Original Message----- > > From: pharo-project-boun...@... > > [mailto:pharo-project-boun...@...] On Behalf > > Of Nicolas Cellier > > Sent: Tuesday, March 10, 2009 3:23 PM > > To: pharo-proj...@... > > Subject: Re: [Pharo-project] OpenSSL - a couple of questions > > > > Schwab,Wilhelm K <bsch...@...> writes: > > > gmane want me to snip... > > _______________________________________________ > Pharo-project mailing list > pharo-proj...@... > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
