Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #18949

Re: bitwise ORing

Message-ID <4F6BDFED.504D@mindspring.com> (permalink)
Date 2012-03-22 21:29 -0500
From pete <pfiland@mindspring.com>
Organization PF
Newsgroups comp.lang.c
Subject Re: bitwise ORing
References <4f6bca1d$0$32222$bbae4d71@news.suddenlink.net>

Show all headers | View raw


Bill Cunningham wrote:
> 
>     What would a function prototype
> look like that takes one parameter but
> several options can be OR'd together in that parameter? For example:
> 
> function(LEFT|RIGHT);
> 
> What would the parameter source code look like?

/* BEGIN new.c */

#include <stdio.h>

#define LEFT        0xdead0000
#define RIGHT       0x0000beef

void
function(long unsigned X)
{
    printf("\n%lx\n", X);
}

int
main(void)
{
    function(LEFT|RIGHT);
    return 0;
}

/* END new.c */


-- 
pete

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

bitwise ORing "Bill Cunningham" <nospam@nspam.invalid> - 2012-03-22 20:56 -0500
  Re: bitwise ORing pete <pfiland@mindspring.com> - 2012-03-22 21:29 -0500
  Re: bitwise ORing Lew Pitcher <lpitcher@teksavvy.com> - 2012-03-23 11:19 -0400
    Re: bitwise ORing James Kuyper <jameskuyper@verizon.net> - 2012-03-23 11:43 -0400
    Re: bitwise ORing "Bill Cunningham" <nospam@nspam.invalid> - 2012-03-23 16:23 -0500
    Re: bitwise ORing "Bill Cunningham" <nospam@nspam.invalid> - 2012-03-25 13:02 -0500
      Re: bitwise ORing Lew Pitcher <lpitcher@teksavvy.com> - 2012-03-25 16:26 -0400
  Re: bitwise ORing jgk@panix.com (Joe keane) - 2012-03-23 20:31 +0000
  Re: bitwise ORing Don Y <this@isnotme.com> - 2012-03-23 13:41 -0700
    Re: bitwise ORing "Joachim Schmitz" <nospam.jojo@schmitz-digital.de> - 2012-03-24 11:29 +0100
      Re: bitwise ORing Geoff <geoff@invalid.invalid> - 2012-03-24 19:06 -0700

csiph-web