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

G

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.

Thanks in advanced,

Graham
 
A

Alf P. Steinbach

* 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.
 
M

Minti

* Graham:

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.
 
P

puppet_sock

[email protected] (Minti) wrote in message news: said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top