Mixing metaphors seems to favor existence.

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Dann Corbit
Posts: 12541
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Mixing metaphors seems to favor existence.

Post by Dann Corbit »

Code: Select all

#include <stdio.h>
int main&#40;void&#41;
&#123;
    printf&#40;"The answer is %x, or is it %x?  Hmmm... Makes no sense.  Maybe %x &#40;if the Bard approve of mixing metaphors&#41;?\n", 
           0x2b || !0x2b, 0x2b | ~0x2b, 0x2b | !0x2b&#41;;
    return 0;
&#125;
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Mixing metaphors seems to favor existence.

Post by bob »

i'll byte here...

what is the point?? :)

Perhaps that some don't understand the ! operator? :)
Dann Corbit
Posts: 12541
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Mixing metaphors seems to favor existence.

Post by Dann Corbit »

It's just a lame Shakespeare joke that occurred to me when I was thinking about bit patterns.

"To be or not to be", as logical or bitwise operations results in 1 or -1, but mixing the operations as I chose results in 'to be.'

For some reason, it struck me funny.
Dann Corbit
Posts: 12541
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Mixing metaphors seems to favor existence.

Post by Dann Corbit »

dcorbit@dcorbit /q
$ ./a.exe
The answer is 1, or is it ffffffff? Hmmm... Makes no sense. Maybe 2b (if the Bard approve of mixing metaphors)?
mar
Posts: 2559
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Mixing metaphors seems to favor existence.

Post by mar »

got it. like it. but why the spoiler? :)
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Mixing metaphors seems to favor existence.

Post by bob »

mar wrote:got it. like it. but why the spoiler? :)
Because some of "us" don't think in terms of Shakespeare. :)
mvk
Posts: 589
Joined: Tue Jun 04, 2013 10:15 pm

Re: Mixing metaphors seems to favor existence.

Post by mvk »

Dann Corbit wrote:

Code: Select all

#include <stdio.h>
int main&#40;void&#41;
&#123;
    printf&#40;"The answer is %x, or is it %x?  Hmmm... Makes no sense.  Maybe %x &#40;if the Bard approve of mixing metaphors&#41;?\n", 
           0x2b || !0x2b, 0x2b | ~0x2b, 0x2b | !0x2b&#41;;
    return 0;
&#125;
In your case I wish 0x04 '0x2b'.
[Account deleted]
johnwbyrd
Posts: 9
Joined: Tue Jan 20, 2015 3:22 am

Re: Mixing metaphors seems to favor existence.

Post by johnwbyrd »

I think you've just come up with a fairly subtle DSP interview question. What do the following expressions evaluate to, and why?

0x2b || ~0x2b
0x2b || !0x2b
0x2b | ~0x2b
0x2b | !0x2b

(I added back in the missing combination)
johnwbyrd
Posts: 9
Joined: Tue Jan 20, 2015 3:22 am

Re: Mixing metaphors seems to favor existence.

Post by johnwbyrd »

2 * 0xb | ~2 * 0xb
2 * 0xb | !2 * 0xb

!?