Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: functions with optional arguments in Windows DLLs

by GrandFather (Saint)
on Dec 12, 2007 at 19:40 UTC ( #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? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2021-12-08 23:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (36 votes). Check out past polls.

    Notices?