From WikiChip
Editing binary literal

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.

Latest revision Your text
Line 1: Line 1:
 
'''Binary literal''' is an [[integer]] whose value is represented in the source code using the [[binary number system]]. Binary literals are a feature supported in many programming languages such as [[Java]], [[D]] and [[Python]] as well as a compiler extension in [[C++]] and [[C]]. Binary literals typically start with '''0b''' or '''0B''' followed by a series of binary digits.
 
'''Binary literal''' is an [[integer]] whose value is represented in the source code using the [[binary number system]]. Binary literals are a feature supported in many programming languages such as [[Java]], [[D]] and [[Python]] as well as a compiler extension in [[C++]] and [[C]]. Binary literals typically start with '''0b''' or '''0B''' followed by a series of binary digits.
  
== Programming languages ==
+
== Java ==
=== Java ===
 
 
Starting with [[Java 7]], binary literals are possible to be expressed using the 0b or 0B prefix. For example:
 
Starting with [[Java 7]], binary literals are possible to be expressed using the 0b or 0B prefix. For example:
  
Line 14: Line 13:
 
</source>
 
</source>
  
=== Python ===
+
== Python ==
 
Starting with Python 2.6, binary literals support was added via the "0b" and "0B" prefixes.<ref>[http://docs.python.org/release/3.2.3/reference/lexical_analysis.html#integer­literals 2. Lexical analysis]</ref>
 
Starting with Python 2.6, binary literals support was added via the "0b" and "0B" prefixes.<ref>[http://docs.python.org/release/3.2.3/reference/lexical_analysis.html#integer­literals 2. Lexical analysis]</ref>
  
=== Lisp ===
+
== Lisp ==
 
Lisp supports binary literals to represent integers and rational values via the '''#b''' prefix, for example:
 
Lisp supports binary literals to represent integers and rational values via the '''#b''' prefix, for example:
  
Line 27: Line 26:
 
</source>
 
</source>
  
=== C++ and C ===
+
== C++ and C ==
 
Binary literals already exist in the C++ and C languages in the form of non-standard compiler extensions<ref>[http://gcc.gnu.org/onlinedocs/gcc/Binary-constants.html 6.62 Binary constants using the ‘0b’ prefix]</ref>. They are prefixed with 0b or 0B followed by a series of binary digits. Binary literals have also been proposed<ref>[http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3472.pdf C++14 N3472 Binary Literals in the C++ Core Language]</ref> as a core language addition in [[C++14]].
 
Binary literals already exist in the C++ and C languages in the form of non-standard compiler extensions<ref>[http://gcc.gnu.org/onlinedocs/gcc/Binary-constants.html 6.62 Binary constants using the ‘0b’ prefix]</ref>. They are prefixed with 0b or 0B followed by a series of binary digits. Binary literals have also been proposed<ref>[http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3472.pdf C++14 N3472 Binary Literals in the C++ Core Language]</ref> as a core language addition in [[C++14]].
 
==hardware description language==
 
{{empty section}}
 
  
 
== References ==
 
== References ==
 
{{reflist}}
 
{{reflist}}

Please note that all contributions to WikiChip may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see WikiChip:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)

Templates used on this page:

This page is a member of 1 hidden category: