Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | "Joachim Schmitz" <nospam.jojo@schmitz-digital.de> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: bitwise ORing |
| Date | 2012-03-24 11:29 +0100 |
| Organization | 1&1 Internet AG |
| Message-ID | <jkk7m5$7b2$1@online.de> (permalink) |
| References | <4f6bca1d$0$32222$bbae4d71@news.suddenlink.net> <jkin5p$o42$1@speranza.aioe.org> |
Don Y wrote:
> Hi Bill,
>
> On 3/22/2012 6:56 PM, 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?
>
> Usually, this is an integer (of some size) data type.
> The manifest constants LEFT and RIGHT are typically disjoint
> bitsets (though they need not be). They can also be derived
> from an enumerated type, etc.
>
> E.g., render_text(const char *string, attr_t attributes)
>
> where:
> attributes ::= BLINK | BOLD | DIM | INVISIBLE | ITALIC | etc.
>
> (note my use of '|' here is in the context of a BNF, not a
> C statement; also, this specfication says nothing about how
> "sensible" BLINK | INVISIBLE might be! :> )
>
> So,
> render_text("Big SALE today!!", BOLD | BLINK);
> one of the semantic problems with the use of "or" is that it
> really is implementing what you would COLLOQUIALLY think of
> as an "and" function: "Make this BOLD *and* BLINKing".
#define and | /* ;-) */
...
render_text("Big SALE today!!", BOLD and BLINK);
Bye, Jojo
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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