Connecting Tech Pros Worldwide Forums | Help | Site Map

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

Graham
Guest
 
Posts: n/a
#1: Jul 22 '05
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

Alf P. Steinbach
Guest
 
Posts: n/a
#2: Jul 22 '05

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


* Graham:[color=blue]
>
> 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.[/color]

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?
Minti
Guest
 
Posts: n/a
#3: Jul 22 '05

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


alfps@start.no (Alf P. Steinbach) wrote in message news:<40db5216.1885995437@news.individual.net>...[color=blue]
> * Graham:[color=green]
> >
> > 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.[/color]
>
> 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.[/color]

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
puppet_sock@hotmail.com
Guest
 
Posts: n/a
#4: Jul 22 '05

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


mintiSPAMBLOCK@yahoo.com (Minti) wrote in message news:<e87fc4b0.0406250004.20bc29d1@posting.google. com>...
[snip][color=blue]
> 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.[/color]

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
Closed Thread