Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7939803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:12:51+00:00 2026-06-03T23:12:51+00:00

Possible Duplicate: GCC STL bound checking Is there something like a automatic debug version

  • 0

Possible Duplicate:
GCC STL bound checking

Is there something like a automatic debug version of the std:vector in the g++ STL and if not how could I achive one?

What I want is to specify a debug parameter in my g++ call for example:

g++ -D DEBUG_ main.cpp

When this parameter is defined I want all my std::vectors to check their boundarys when accesing an element, the way when using vector::at().

When the parameter is omitted I want all vectors to behave as if the normal [] operator is used, meaning no performance is “wasted” for boundary checking.

I heard that VC++ does something like this. So my question is how to to this using the g++?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T23:12:53+00:00Added an answer on June 3, 2026 at 11:12 pm

    The flag you want is -D_GLIBCXX_DEBUG

    More debug options for libstdc++ can be found at:

    http://gcc.gnu.org/onlinedocs/libstdc++/manual/debug_mode_using.html#debug_mode.using.mode

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Can I list-initialize a vector of move-only type? I use gcc 4.6.1
Possible Duplicate: How to minify php page html output? Any reason not to strip
Possible Duplicate: A Singleton that is not globally accessible Do you know a good
Possible Duplicate: Space bar not working in form fields Has anyone run into an
Possible Duplicate: problem with template inheritance This code doesn't compile in GCC: template <typename
Possible Duplicate: How do you get assembler output from C/C++ source in gcc? Hello
Possible Duplicate: Should a function have only one return statement? Hello, gcc 4.4.4 c89
Possible Duplicate: Does there exist a static_warning? I often use #warning scattered through my
Possible Duplicate: Invalid read/write sometimes creates segmentation fault and sometimes does not I have
Possible Duplicate: Why does gcc have “â” in all its error messages? New to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.