C++ for Engineers and Scientists
C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 9.6, Problem 3E

(For thought) a. What’s an advantage of namespaces?

b. What’s a possible disadvantage of namespaces?

Blurred answer
Students have asked these similar questions
(c) Does an integer pointer store an integer itself or something else? (d) What is the purpose of pointers? What do they allow us to do? What would happen if we didn't have pointers?
The issues:Memory leaks, bad pointers, and writing to the end of the memory allotted.When it comes to memory management, C++ offers a tonne of freedom. You can directly work with pointers and allocate and deallocate memory. Flexibility entails a price. You can make mistakes with allocations because the language lets you do so. The usage of pointers and deallocation are both subject to error. What can you do to secure your code because C++ lacks built-in safety checks?
The Problems: Bad pointers, writing of the end of allocated memory, memory leaks.C++ gives you lots of flexibility when it comes to memory management. You are allowed to allocate and deallocate memory and directly manipulate pointers.Flexibility comes with a cost. Because the language allows you to allocate memory, you can screw up the allocations. Similarly you can screw up the deallocation and use of pointers. Since there are no built-in safety checks in C++ what do you do to protect your code?
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Computer Fundamentals - Basics for Beginners; Author: Geek's Lesson;https://www.youtube.com/watch?v=eEo_aacpwCw;License: Standard YouTube License, CC-BY