What does this type casting means...(dvoid * (*)(dvoid *, size_t)) [message #309571] |
Thu, 27 March 2008 23:18  |
patil.vishwa
Messages: 7 Registered: December 2006 Location: Bangalore,India
|
Junior Member |
|
|
Hi,
Could any one explain this, type casting(...(dvoid * (*)(dvoid *, size_t))...) in detail and what dvoid keyword means.
Example..:
OCIEnvCreate(
(OCIEnv **)envhp,
OCI_DEFAULT,
(dvoid *)0,
(dvoid * (*)(dvoid *, size_t))0,
(dvoid * (*)(dvoid *, dvoid *, size_t))0,
(void (*)(dvoid *, dvoid *))0,
(size_t)0,
(dvoid **)0
)
Regards,
Vishwa....
|
|
|
Re: What does this type casting means...(dvoid * (*)(dvoid *, size_t)) [message #309596 is a reply to message #309571] |
Fri, 28 March 2008 01:43   |
vicenzo
Messages: 28 Registered: December 2007 Location: Paris
|
Junior Member |
|
|
Oracle examples always type cast most of the functions parameters.
OCIEnvCreate() take 2 callback functions for memory allocation (that are rarely used)
So you commonly pass 0 or NULL for thoses params.
Because Oracle likes type casting, null params value are casted with the parameter type.
In the case of function, the type cast is made with the function prototype.
dvoid is just a #define around void.
[Updated on: Fri, 28 March 2008 01:44] Report message to a moderator
|
|
|
Re: What does this type casting means...(dvoid * (*)(dvoid *, size_t)) [message #309704 is a reply to message #309596] |
Fri, 28 March 2008 09:10   |
patil.vishwa
Messages: 7 Registered: December 2006 Location: Bangalore,India
|
Junior Member |
|
|
Hi vicenzo,
Thanks a lot for your time and quick response .
As you told, most of the programmers uses the zero value for these (memory allocation/free function) parameters.
So what is the use of these functions and when do we need them?
one more thing...
I understand that, environment handle contains a memory cache which gets created by OCIEnvCreate() function.
But what would be the memory cache size when it is created ,
as we are nowhere mentioning the size explicitly while calling OCIEnvCreate() function.
Does oracle allocates some standard size for it...?
I dont think dvoid is not just a #define of void,there must be some diff between them,b'coz few parameters are type casted as dvoid and few as void.
Regards,
Vishwa....
[Updated on: Fri, 28 March 2008 09:14] Report message to a moderator
|
|
|
|