Talk:Bitwise operations in C

Latest comment: 1 year ago by PrimeBOT in topic India Education Program course assignment

Hello edit

This page is under development. We feel that a page on bitwise operations detailing only in C-programming language needs an independent page. Please co-operate. Any discussions or any suggestions are respectfully welcomed. Please write them here. Thakarepiyush (talk) 14:27, 15 September 2011 (UTC)Reply

Hi. Thanks, this article was helpful. I've never seen the term "EX-OR" used anywhere else though. I think "XOR" is the standard. — Preceding unsigned comment added by 66.188.89.180 (talk) 15:59, 25 November 2012 (UTC)Reply

Thanks for creating this page. Just wanted to mention that the first External Link seems to be broken. — Preceding unsigned comment added by 69.12.159.96 (talk) 16:03, 30 May 2013 (UTC)Reply

This page is very useful, but could you explain this example a little more:

 If the variable ch contains the bit pattern 11100101, then ch >> 1 will give the output as 11110010, and ch >> 2 will give 01111001.

What happens to the bits shifted in on the left? Why does ch >> 1 leave a 1 on the left, but ch >> 2 leaves a 0? And what does "unsigned type" mean? — Preceding unsigned comment added by 129.215.138.131 (talk) 10:26, 15 January 2014 (UTC)Reply

Confusing Intro edit

"Bitwise operations are contrasted by byte-level operations which characterize the bitwise operators' logical counterparts, the AND, OR and NOT operators." So is AND, OR, and NOT bitwise, bytewise (whatever the official, fancy name for that is anyway), or both? it's not all that clear in the intro 50.153.115.17 (talk) 14:55, 26 May 2015 (UTC)Reply

Agreed. The intro is disappointingly confusing and wrong. First off, C's bitwise operators can operate on any integral type, not just bytes. The distinction the writer is trying to make is whether the operator applies the logic operation to each bit in the arguments individually, or instead treats each argument as a single true/false value. The latter corresponds to the AND, OR etc referred to, though they are not called AND and OR etc in C, they are &&, || and so on. It is true that C has no operator that operates on two single-bit arguments, because there's no single-bit data type. This is generally not a problem as the bitwise operators can be used in a way which singles out a particular bit. Gwideman (talk) 06:43, 18 May 2016 (UTC)Reply

Nominating Section 5 for deletion edit

What if anything does section 5 signify? And if you think it might be useful to someone, then what is the example program trying demonstrate? Kotika98 (talk) 03:59, 3 April 2016 (UTC)Reply

The stuff at the top about correspondences between bitwise and logical seems relevant and on-topic (particularly the non-obvious XOR case). The extended example code serves no purpose though, I think. 79.65.68.202 (talk) 00:50, 4 January 2018 (UTC)Reply

False statement about shift operators edit

The statement "when performed on a signed type, the result is technically undefined and compiler dependent" with regards to shift operators is not correct. It's only undefined if the left operand is negative or if the result of the operation is not representable by the type of the left operand (i.e. it would overflow). If this overly generalized and unnuanced statement were true, even "1 << 1" would be undefined, as decimal literals have an implicit signed int type. — Preceding unsigned comment added by 185.164.138.19 (talk) 00:33, 27 July 2018 (UTC)Reply

Bitwise NOT section reads like it was copied from someones blog. edit

The current contents of the Bitwise NOT section read like they were copied and pasted from someones blog, and use non-encyclopedic language. Indeed, at a minimum they seem to fall afoul of MOS:INSTRUCT, with language like "Now that we have a way of flipping bit", and "We need to come up with a sequence" and "How can we get that number?" (also fall afoul of MOS:QUESTION) and "You might be thinking to yourself". This section needs to be re-written from a NPOV, avoiding falling into using the language of instruction. Yaztromo (talk) 22:18, 1 June 2021 (UTC)Reply

India Education Program course assignment edit

  This article was the subject of an educational assignment at College Of Engineering Pune supported by Wikipedia Ambassadors through the India Education Program during the 2011 Q3 term. Further details are available on the course page.

The above message was substituted from {{IEP assignment}} by PrimeBOT (talk) on 20:14, 1 February 2023 (UTC)Reply