473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Question of function argument

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!
Jul 22 '05 #1
3 1206

"gigal" <gi*******@168.com> wrote in message
news:tZ********************@bgtnsc05-news.ops.worldnet.att.net...
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
Jul 22 '05 #2
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
gigal wrote:
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!


Jul 22 '05 #3
Corne' Cornelius wrote:
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.
bitwise OR'd together
gigal wrote:
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!

Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Joe | last post by:
The recipe in question is "Implementing Static Methods". It shows how to use staticmethod(). This sentence in the Discussion section isn't clear to me: "An attribute of a class object that...
6
by: Csaba2000 | last post by:
How do I achieve the following in javascript, the emphasis being on the NN (6.1) 'event' parameter that needs to be declared? This is the current method - works just fine: <TABLE border...
51
by: Alan | last post by:
hi all, I want to define a constant length string, say 4 then in a function at some time, I want to set the string to a constant value, say a below is my code but it fails what is the correct...
4
by: anonymous | last post by:
Thanks your reply. The article I read is from www.hakin9.org/en/attachments/stackoverflow_en.pdf. And you're right. I don't know it very clearly. And that's why I want to understand it; for it's...
3
by: Christopher Benson-Manica | last post by:
Given that modf is prototyped as double modf( double x, double *iptr ); is the behavior of the function well-defined if the address of x is passed as the value of iptr? -- Christopher...
3
by: xllx.relient.xllx | last post by:
I have a question about an example presented in the book "INFORMIT C++ Reference Guide" by Danny Kalev: <code> string getmagicword() ( return string("Supercalifragilisticexpialidocious"); );
15
by: nikki_herring | last post by:
I am using setTimeout( ) to continuously call a function that randomly rotates/displays 2 images on a page. The part I need help with is the second image should rotate 3 seconds after the first...
35
by: rebeccatre | last post by:
hi can Variant archiving setTimout('.. capability be done without using it? :-)
7
by: RubyRedRick | last post by:
I bought Crockford's "JavaScript: The Good Parts" yesterday to help build my JavaScript foo. On page 44, he gives an implementation of the curry function: Function.method('curry', function() {...
16
by: mdh | last post by:
I have a question about the library function strcpy. In K&R on page 109, strcpy is used to copy a line ( line ) to a pointer (char *), which is first allocated space by K&Rs "alloc" function. In...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.