Home » Developer & Programmer » Precompilers, OCI & OCCI » What does this type casting means...(dvoid * (*)(dvoid *, size_t)) (oracle)
What does this type casting means...(dvoid * (*)(dvoid *, size_t)) [message #309571] Thu, 27 March 2008 23:18 Go to next message
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 Go to previous messageGo to next message
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 Go to previous messageGo to next message
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

Re: What does this type casting means...(dvoid * (*)(dvoid *, size_t)) [message #535555 is a reply to message #309704] Wed, 14 December 2011 15:43 Go to previous message
atulindore2
Messages: 1
Registered: December 2011
Junior Member
hi viceno,
as u said

quote viceno:
"Because Oracle likes type casting..."

Can I do away with all that typecasting which just inflates my code and possibly make it unreadable?

[Updated on: Thu, 15 December 2011 00:58] by Moderator

Report message to a moderator

Previous Topic: Recompile required when upgrading from Oracle 9i to 11g
Next Topic: precompiler error codes PCC-S-02014 & PCC-F-02102
Goto Forum:
  


Current Time: Thu Dec 18 01:30:54 CST 2014

Total time taken to generate the page: 0.10910 seconds