473,414 Members | 1,677 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

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 multidimensional 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 multidimensional arrays in C++ are not
desirable? That doesn't seem right to me.

Thanks in advanced,

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

On page 89 of Stroustrup's book "The C++ Programming Language" 3rd Ed.
He says that multidimensional 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 multidimensional 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 multidimensional 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 multidimensional 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.google. 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
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...
11
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
by: infobahn | last post by:
printf("%p\n", (void *)0); /* UB, or not? Please explain your answer. */
3
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...
12
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...
94
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...
3
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"...
4
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'...
14
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 =...
30
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...
0
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...

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.