Question of function argument

G

gigal

Could someone explain how the function is defined with argument like this?

bool select(long lEvent = FD_READ | FD_WRITE | FD_OOB | FD_ACCEPT |
FD_CONNECT | FD_CLOSE );

Thank you very much!
 
J

John Harrison

gigal said:
Could someone explain how the function is defined with argument like this?

bool select(long lEvent = FD_READ | FD_WRITE | FD_OOB | FD_ACCEPT |
FD_CONNECT | FD_CLOSE );

Thank you very much!

What's to explain? It's a function called select, it returns a bool, it has
a single parameter of type long.

Maybe what's confusing you is that the parameter has a default value, if the
caller of the function doesn't supply an argument then a default value of
FD_READ | FD_WRITE | FD_OOB | FD_ACCEPT | FD_CONNECT | FD_CLOSE will be used
instead.

Does that help? If not explain a little more about what exactly you don't
understand.

john
 
C

Corne' Cornelius

Hi,

That means that it's a function called select, returns bool, and has an
argument called lEvent of type long, with a default value of all those
FD_* (probably #defines or enums) bitwise OR'd together
 
J

Jeff Schwab

Corne' Cornelius said:
Hi,

That means that it's a function called select, returns bool, and has an
argument called lEvent of type long, with a default value of all those
FD_* (probably #defines or enums)

Or long const's.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,169
Messages
2,570,917
Members
47,458
Latest member
Chris#

Latest Threads

Top