Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Why no boundry condition set for C++

Why no boundry condition set for C++

Scheduled Pinned Locked Moved C / C++ / MFC
7 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hassan Syed1
    wrote on last edited by
    #1

    What is the main reason even till day-today there is no boundry condition set for C++. Why not compiler resist that we are pointing something out of the range of our array or we are pointing to a memory location which we cannot points to as it is not in the allowed range of our source code. Why not C++ creator or the IOS committee which build the standard put a check on this thing. There must be some reason of this freedom to point anywhere. I want to know that reason why they are doing like this. If a person like bjarne stroustrup can write such an advance programming language then there must be something special he left this imporant check to move in memory anywhere. If you know about this please share with me. I am curious to know the logic behind it. I asked this question from my teacher but instead of answering me he said this is not a part of my course :( I am new student to programming

    L P L enhzflepE M 5 Replies Last reply
    0
    • H Hassan Syed1

      What is the main reason even till day-today there is no boundry condition set for C++. Why not compiler resist that we are pointing something out of the range of our array or we are pointing to a memory location which we cannot points to as it is not in the allowed range of our source code. Why not C++ creator or the IOS committee which build the standard put a check on this thing. There must be some reason of this freedom to point anywhere. I want to know that reason why they are doing like this. If a person like bjarne stroustrup can write such an advance programming language then there must be something special he left this imporant check to move in memory anywhere. If you know about this please share with me. I am curious to know the logic behind it. I asked this question from my teacher but instead of answering me he said this is not a part of my course :( I am new student to programming

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You should ask Bjarne Stroustrup[^].

      H 1 Reply Last reply
      0
      • L Lost User

        You should ask Bjarne Stroustrup[^].

        H Offline
        H Offline
        Hassan Syed1
        wrote on last edited by
        #3

        If you don't know the answer by ur-self then keep quite.

        1 Reply Last reply
        0
        • H Hassan Syed1

          What is the main reason even till day-today there is no boundry condition set for C++. Why not compiler resist that we are pointing something out of the range of our array or we are pointing to a memory location which we cannot points to as it is not in the allowed range of our source code. Why not C++ creator or the IOS committee which build the standard put a check on this thing. There must be some reason of this freedom to point anywhere. I want to know that reason why they are doing like this. If a person like bjarne stroustrup can write such an advance programming language then there must be something special he left this imporant check to move in memory anywhere. If you know about this please share with me. I am curious to know the logic behind it. I asked this question from my teacher but instead of answering me he said this is not a part of my course :( I am new student to programming

          P Offline
          P Offline
          Patrice T
          wrote on last edited by
          #4

          Hassan Syed1 wrote:

          What is the main reason even till day-today there is no boundry condition set for C++.

          It is by design, just like with C, its ancestor language. You, as a programmer, are responsible to do all the checking manually. May be you should ask Brian Kernighan and Dennis Ritchie. The C Programming Language - Wikipedia, the free encyclopedia[^] The C++ Programming Language - Wikipedia, the free encyclopedia[^]

          Patrice “Everything should be made as simple as possible, but no simpler.” Albert Einstein

          1 Reply Last reply
          0
          • H Hassan Syed1

            What is the main reason even till day-today there is no boundry condition set for C++. Why not compiler resist that we are pointing something out of the range of our array or we are pointing to a memory location which we cannot points to as it is not in the allowed range of our source code. Why not C++ creator or the IOS committee which build the standard put a check on this thing. There must be some reason of this freedom to point anywhere. I want to know that reason why they are doing like this. If a person like bjarne stroustrup can write such an advance programming language then there must be something special he left this imporant check to move in memory anywhere. If you know about this please share with me. I am curious to know the logic behind it. I asked this question from my teacher but instead of answering me he said this is not a part of my course :( I am new student to programming

            L Offline
            L Offline
            leon de boer
            wrote on last edited by
            #5

            You are assuming that there are ordered limits to the set and that boundary has meaning. In a nutshell you seem to be inferring that sets are something like ordered numbers. It's a construction class so lets expand it to the general form, I have a set I called animals in which I inserted an chicken, a pig and a dog. I now have a Lion is this inside or outside the boundary condition of my animal set? Do you see the problem with your question? What if I told you that my animal set was domestic animals does that change your answer? Do you get that even if I have a set of numbers in a generic set, those numbers are just place holders for "things" such as animals ... they aren't really numbers like you are using them. So you may want to review set theory Set theory - Wikipedia, the free encyclopedia[^] So the correct answer is if you want boundary conditions on your set because there is some logical order to them, then extend the class yourself. That behaviour is not natural to a generic set class so why would you expect it to be in a generic set class. Nobody has ever asked for that behaviour because it's wrong under set theory, as you are making some very specific sorted or ordered set.

            In vino veritas

            1 Reply Last reply
            0
            • H Hassan Syed1

              What is the main reason even till day-today there is no boundry condition set for C++. Why not compiler resist that we are pointing something out of the range of our array or we are pointing to a memory location which we cannot points to as it is not in the allowed range of our source code. Why not C++ creator or the IOS committee which build the standard put a check on this thing. There must be some reason of this freedom to point anywhere. I want to know that reason why they are doing like this. If a person like bjarne stroustrup can write such an advance programming language then there must be something special he left this imporant check to move in memory anywhere. If you know about this please share with me. I am curious to know the logic behind it. I asked this question from my teacher but instead of answering me he said this is not a part of my course :( I am new student to programming

              enhzflepE Offline
              enhzflepE Offline
              enhzflep
              wrote on last edited by
              #6

              It sounds an awful lot like you're asking - why does a fast and powerful language like C++ not have one of the performance killers of languages that require less skill to use. Simply, because with C/C++ you're given the power to shoot yourself in the foot. If you do so, it's your own stupid fault, not that of the language that lets you do it. If you have an array of a million elements and you wish to access each of them, you're expected to know that you're not trying to access an element before or after your allocated memory. The alternative is to assume you have or will screw-up and to perform 1 million bounds checking operations. No - that's not cool. That's a nice feature for sub-par programmers. Also, hassan syed1 - it's Bjarne Stroustrup, not bjarne stroustrup. You capitalized your own name but thought his not significant enough to afford him the same respect?

              1 Reply Last reply
              0
              • H Hassan Syed1

                What is the main reason even till day-today there is no boundry condition set for C++. Why not compiler resist that we are pointing something out of the range of our array or we are pointing to a memory location which we cannot points to as it is not in the allowed range of our source code. Why not C++ creator or the IOS committee which build the standard put a check on this thing. There must be some reason of this freedom to point anywhere. I want to know that reason why they are doing like this. If a person like bjarne stroustrup can write such an advance programming language then there must be something special he left this imporant check to move in memory anywhere. If you know about this please share with me. I am curious to know the logic behind it. I asked this question from my teacher but instead of answering me he said this is not a part of my course :( I am new student to programming

                M Offline
                M Offline
                Maximilien
                wrote on last edited by
                #7

                It does offer boundary condition, just use modern C++ constructs (vector, array, string...) instead of their unsafe C equivalent (pointers, char*...) If you are using a modern version of Visual Studio, there are additional checks made by the compiler and runtime to check boundary conditions (Security Features in the CRT[^]) and also they offer a set of safer runtime API (all the _s functions like strcpy_s instead of strcpy) Remember that if the language let you shoot yourself in the foot, there is no excuse try not to by following best practice when coding.

                I'd rather be phishing!

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups