473,765 Members | 1,964 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What does Stroustrup mean on pg 89 of C++PL 3rd Ed. by "low-level code"

On page 89 of Stroustrup's book "The C++ Programming Language" 3rd Ed.
He says that multidimensiona l arrays are best avoided outside
low-level code.

What precisely does he mean by low-level code? That is fairly
relative terminology.

Is he saying that the use of multidimensiona l arrays in C++ are not
desirable? That doesn't seem right to me.

Thanks in advanced,

Graham
Jul 22 '05 #1
3 2201
* Graham:

On page 89 of Stroustrup's book "The C++ Programming Language" 3rd Ed.
He says that multidimensiona l arrays are best avoided outside
low-level code.

What precisely does he mean by low-level code? That is fairly
relative terminology.

Is he saying that the use of multidimensiona l arrays in C++ are not
desirable? That doesn't seem right to me.


It is a relative term, not an absolute one.

Put another way, whenever there isn't too high a price to pay for
abstracting raw arrays, hiding them away behind safe interfaces (such as
in e.g. std::vector), do so.

The low-level code is then the once-only code that deals with the raw
arrays directly, and the higher level code the code that uses the safer
abstraction.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #2
al***@start.no (Alf P. Steinbach) wrote in message news:<40******* **********@news .individual.net >...
* Graham:

On page 89 of Stroustrup's book "The C++ Programming Language" 3rd Ed.
He says that multidimensiona l arrays are best avoided outside
low-level code.

What precisely does he mean by low-level code? That is fairly
relative terminology.

Is he saying that the use of multidimensiona l arrays in C++ are not
desirable? That doesn't seem right to me.


It is a relative term, not an absolute one.

Put another way, whenever there isn't too high a price to pay for
abstracting raw arrays, hiding them away behind safe interfaces (such as
in e.g. std::vector), do so.

The low-level code is then the once-only code that deals with the raw
arrays directly, and the higher level code the code that uses the safer
abstraction.


Hmm... By that argument he must say that @arrays@ rather than just
multi-dimension arrays in general must be avoided outside low level
code. IIRC he does say that else where. But that is not clear from the
current context.
P.S. I don't have TC++ at my desktop right now.

--
Imanpreet Singh Arora
isingh AT acm DOT org
Jul 22 '05 #3
mi************@ yahoo.com (Minti) wrote in message news:<e8******* *************** ****@posting.go ogle.com>...
[snip]
Hmm... By that argument he must say that @arrays@ rather than just
multi-dimension arrays in general must be avoided outside low level
code. IIRC he does say that else where. But that is not clear from the
current context.


Actually, the standard library makes plain old arrays undesirable
in many cases. At least to the extent that you should consider
whether you actually need an array or would be better suited using
one of the standard containers. I'm sure we could have a rollicking
good time finding examples where an array is preferable.
Socks
Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

77
5383
by: Jon Skeet [C# MVP] | last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the article on all the groups this is posted to. I've finally managed to finish my article on multi-threading - at least for the moment. I'd be *very* grateful if people with any interest in multi-threading would read it (even just bits of it - it's somewhat long to go through the whole thing!) to check for accuracy, effectiveness of examples, etc. Feel free to mail...
11
8898
by: L. Chen | last post by:
The standard says that a char* or void* pointer has the least strict alignment. But I do not know what is a strict alignment. What does that mean?
188
17427
by: infobahn | last post by:
printf("%p\n", (void *)0); /* UB, or not? Please explain your answer. */
3
3127
by: asognoth | last post by:
Hi... Does anybody have a clue how to solve this problem? the task is to change the following method in that manner that it draws the (calculated) image form left to right instead of from top to bottom. The image is actually a waterfall model of sound data. I tried desperatly, but I don't see how to swap the x and y coordinates.
12
1768
by: erikcw | last post by:
Hi all, I have a collection of ordered numerical data in a list. The numbers when plotted on a line chart make a low-high-low-high-high-low (random) pattern. I need an algorithm to extract the "significant" high and low points from this data. Here is some sample data: data =
94
30349
by: Samuel R. Neff | last post by:
When is it appropriate to use "volatile" keyword? The docs simply state: " The volatile modifier is usually used for a field that is accessed by multiple threads without using the lock Statement (C# Reference) statement to serialize access. " But when is it better to use "volatile" instead of "lock" ?
3
13253
by: Rahul Babbar | last post by:
Hi, I had the following doubts about the "For Read Only" clause. 1. How does a "for Read only" clause improve the performance? 2. How does a "for Read only" clause compare with "With UR" clause in performance? Which is faster? Can someone clarify on that?
4
3102
by: lander | last post by:
I've read the page life cycle thing in msdn, still, i'm getting a bit confused of thinking how all the things are going under the hood... I know that when page loading, that the controls' properties is populated and when page unloading, the resources are cleared. What I want to know is what's happening behind it, that is, from the perspective of the asp.net implementor.....I'm not sure whether i've stated clearly, hope you get it.
14
2519
by: =?GB2312?B?zPC5zw==?= | last post by:
Howdy, I wonder why below does not work. a = object() a.b = 1 # dynamic bind attribute failed... To make it correct, we have to create a new class: class MyClass(object): pass a = MyClass() a.b = 1 # OK
30
3844
by: Medvedev | last post by:
i see serveral source codes , and i found they almost only use "new" and "delete" keywords to make they object. Why should i do that , and as i know the object is going to be destroy by itself at the end of the app for example: class test { public: int x;
0
10161
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9955
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9833
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8831
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7378
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.