By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,738 Members | 1,682 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,738 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
* 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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.