C++Builder > Binary Number 0b1 Causes Error E2141 - Stack Overflow

Just browsing Stack Overflow? Help us improve your experience. Sign up for research
    1. Home
    2. Questions
    3. Tags
    4. Users
    5. Companies
    6. Labs
    7. Jobs
    8. Discussions
    9. Collectives
    10. Communities for your favorite technologies. Explore all Collectives

  1. Teams

    Ask questions, find answers and collaborate at work with Stack Overflow for Teams.

    Try Teams for free Explore Teams
  2. Teams
  3. Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Get early access and see previews of new features.

Learn more about Labs C++Builder > binary number 0b1 causes error E2141 Ask Question Asked 8 years, 3 months ago Modified 8 years, 3 months ago Viewed 1k times 1

I am using C++ Builder XE4.

I am trying to use a binary number such as 0b1 in my code.

Following is the code I tried:

void __fastcall TForm1::Button1Click(TObject *Sender) { int num = 0b11; }

The above causes a compiler error:

Unit1.cpp(19): E2141 Declaration syntax error

Does C++Builder support binary numeration like this?

I confirmed that 0x11 works in C++Builder.

I also confirmed that 0b11 can be used in IDEOne using C++:

http://ideone.com/oy4aIZ

Share Improve this question Follow edited Aug 18, 2016 at 0:59 Remy Lebeau's user avatar Remy Lebeau 591k33 gold badges491 silver badges829 bronze badges asked Aug 17, 2016 at 9:54 sevenOfNine's user avatar sevenOfNinesevenOfNine 1,55418 silver badges39 bronze badges 1
  • 3 I'd guess the compiler simply doesn't support it. – Joey Commented Aug 17, 2016 at 10:04
Add a comment |

2 Answers 2

Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 2

Binary notation of integer literals is a new feature in C++14. However, no C++Builder version has a C++14 compiler at this time.

In XE4, the Win32 compiler and OSX compiler do not support C++11 at all (a 32bit C++11 compiler was added in 10.0 Seattle). The Win64 compiler supports C++11, though.

The current C++Builder compilers support only decimal, octal, and hex. See Embarcadero's documentation for details: Integer Constants

Share Improve this answer Follow answered Aug 18, 2016 at 1:19 Remy Lebeau's user avatar Remy LebeauRemy Lebeau 591k33 gold badges491 silver badges829 bronze badges 1
  • Thank you all. I was trying to find this kind of information using google, but without success. Now I can find it using keyword "Integer Constants". I appreciate it. – sevenOfNine Commented Aug 18, 2016 at 2:13
Add a comment | 1

If you want to compile this, you will need a newer version of the C++ Builder with a C++11 compiler.

Share Improve this answer Follow answered Aug 17, 2016 at 11:02 Kerem's user avatar KeremKerem 4495 silver badges22 bronze badges 2
  • 2 In XE4, the Win64 compiler is a C++11 compiler, but the Win32 compiler and OSX compiler are not. – Remy Lebeau Commented Aug 18, 2016 at 1:11
  • 2 However, according to this reference and this article, binary notation is new in C++14, not C++11. – Remy Lebeau Commented Aug 18, 2016 at 1:11
Add a comment |

Your Answer

Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid …

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.

Draft saved Draft discarded

Sign up or log in

Sign up using Google Sign up using Email and Password Submit

Post as a guest

Name Email

Required, but never shown

Post Your Answer Discard

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.

  • The Overflow Blog
  • Your docs are your infrastructure
  • Featured on Meta
  • More network sites to see advertising test [updated with phase 2]
  • We’re (finally!) going to the cloud!
  • Call for testers for an early access release of a Stack Overflow extension...
1 Borland C++: Ambiguity with std (error E2015) 0 Weird linker error on Borland C++ Builder 6 2 Borland C++ Builder compile error 0 Borland Warning 8092 7 c++ Builder xe5 Error detected (LME288) 1 C++ Builder E2303 Type name expected 1 E2316 in using std::function 0 C++ Builder [bcc32 Error] Unit1.cpp(18): E2040 Declaration terminated incorrectly 1 How to resolve Exception Error in C++ Builder 0 error in _bitset.h file header file: array must have at leas one element

Hot Network Questions

  • Groups with no proper non-trivial fully invariant subgroup
  • Are there any examples of exponential algorithms that use a polynomial-time algorithm for a special case as a subroutine (exponentially many times)?
  • Table tennis tournament scoreboard
  • I am the owner of an image. I published it in Unsplash. Am I allowed to upload that same image to other sites?
  • Weapon Mastery and Weapon Cantrips
  • Reducing wattage of a portable car heater
  • What is the polymorph reached by letting the chocolate cool down?
  • Table structure with multiple foreign keys and values
  • Polynomial.java - a Java class for dealing with polynomials with BigDecimal coefficients
  • Is Isaiah's suffering servant the prophet Jeremiah?
  • Is there a cryptographic method that can only decrypt for a certain range of seeds?
  • Will a laptop battery that stays connected to its charger be damaged?
  • Why didn't Steve Zahn receive a credit for Silo?
  • How to say "Each one of the following" in German?
  • Group cohomology valued in a bimodule
  • Identifying a TNG episode where Dr. Pulaski instructs another doctor on a sling
  • testing for a correlation between a real number and percentage accuracy
  • How can I avoid overusing her/she or the character name when describing character action
  • Do I need Letter of invitation to Iceland?
  • What mechanism could cause a person not to cast a reflection?
  • What is this Stardew Valley item?
  • Shell Script to Normalize the data
  • Clarification of notions regarding kinetic energy and kinetic theory of matter
  • How to design for API use cases that need different data from the same table?
more hot questions Question feed Subscribe to RSS Question feed

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Từ khóa » C 0b1