Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: functions with optional arguments in Windows DLLs

by GrandFather (Saint)
on Dec 12, 2007 at 19:40 UTC ( [id://656695]=note: print w/replies, xml ) Need Help??


in reply to functions with optional arguments in Windows DLLs

As BrowserUK suggests, C doesn't have Optional arguments. However C++ does (with some constraints). In essence the C++ compiler takes care of it for you by providing the default value at call time if you haven't provided a value yourself. C++ also provides function overloading where different functions with the same name (but different prototypes) may be used. If you are really dealing with sparsely documented C++ then you are in a world of pain.

Actually, if it is C++ then the situation is even worse because C++ mangles identifiers. The identifier the linker sees is not the identifier that was compiled, and there are no rules for how that mangling is done.

Arguments that are notionally optional in C generally accept a 0 (NULL) if they are not being provided. Most often such arguments are pointers so you are simply passing a null pointer to the function.


Perl is environmentally friendly - it saves trees
  • Comment on Re: functions with optional arguments in Windows DLLs

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://656695]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-18 20:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found