LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-18-2006, 06:36 AM   #1
slzckboy
Member
 
Registered: May 2005
Location: uk - Reading
Distribution: slackware 14.2 kernel 4.19.43
Posts: 462

Rep: Reputation: 30
function definition query


sorry for the vague title..

my question is this.
I am using the libxml API and I have come accross something that I need some help understanding.

if a function if defined as
Code:
return_type somefunction(parm1,par2...)
{

variabletype variable1;
...
variabletype varibalen;
int option;    /*a combination of predefined options */
}
and the available options are declared as
Code:
enum the_options{
OPT1 1,OPT2 30,OPT3 50}.
then do I just or them together,i.e option=OPT1|OPT2|OPT3 if I want to define more than one of the options??

Also what would the code look like then that read OPT1|OPT2|OPT3???

Thanks in advance.
 
Old 04-18-2006, 08:29 AM   #2
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 36
It's interesting that int options is not declared as an enum datatype, but the enum does not have a zero value. enums default to integer.

Code:
int options=OPT1|OPT2|OPT3;
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need a Definition dudeman41465 Linux - Software 2 11-07-2005 05:07 AM
Defining a non-inline function inside class definition (tm) Programming 6 05-11-2005 09:14 AM
A main can be changed by a function local without passing anything to the function? ananthbv Programming 10 05-04-2004 01:31 PM
Perl exec function in linux (and system-function) nazula Programming 1 04-19-2004 12:21 PM
New terminal definition gdeckler Linux - Newbie 1 10-06-2003 11:38 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration