== Quote from Walter Bright (newshou...@digitalmars.com)'s article
> True, but dynamic arrays offer no inherent protection against overlap, though
> you can add a runtime check for that.
Another reason why we should have memory pool support in Phobos.
On 4/28/2011 9:10 PM, Don wrote:
D reduces the use of pointers. You can do much more with arrays.
True, but dynamic arrays offer no inherent protection against overlap, though
you can add a runtime check for that.
Jens Mueller wrote:
Andrei Alexandrescu wrote:
On 4/28/11 12:57 PM, Jens Mueller wrote:
Walter Bright wrote:
On 4/28/2011 9:19 AM, Daniel Gibson wrote:
But there's no need for a D compiler to optimize loops that just copy
parts of an array into another array (and similar stuff), because in D
On 4/28/11 7:53 PM, bearophile wrote:
Andrei:
C's restricts sets a poor example.
There are infinite things that a compiler can't prove about the code.
Restrict is particularly bad. See
http://www.lysator.liu.se/c/dmr-on-noalias.html (noalias was the initial
name of restrict).
Andrei
Andrei:
> C's restricts sets a poor example.
There are infinite things that a compiler can't prove about the code. Example:
the type system can't prove that @system code that uses pointer arithmetic
contains no bugs, pointers that go past arrays, etc. C99 restrict is just
another example where
On 4/28/11 4:14 PM, Jens Mueller wrote:
Walter Bright wrote:
On 4/28/2011 11:44 AM, Jens Mueller wrote:
Thanks. So if a compiler can assume that pointers do not alias it can
generate much better code. What's D's standpoint on that matter then?
C99 has restrict. I never came across something sim
Moritz Warning:
> When the contents are both const, then there won't be any writing
> to it, of course. In that case the same optimizations can be applied as
> when they point to different memory.
>
> both arrays point to different memory.
I see, thank you.
Bye,
bearophile
On Thu, 28 Apr 2011 17:44:35 -0400, bearophile wrote:
> Walter:
>
>> On 4/28/2011 11:44 AM, Jens Mueller wrote:
>> > Thanks. So if a compiler can assume that pointers do not alias it can
>> > generate much better code. What's D's standpoint on that matter then?
>> > C99 has restrict. I never came
Jens Mueller:
> That allows specifying that the memory pointed to is only readable which
> enables doing the optimizations. But what if the memory is writable but
> I can my sure that the pointers pointing to it will never alias? How do
> I pass that information to the compiler?
Here's my answer.
> "restrict" means "this pointer has no alias".
Jens Mueller is right, it's not just pointers, a.ptr and b.ptr are distinct but
they refer to memory zones that are not distinct:
auto a = [1, 2, 3, 4, 5];
auto b = [1 .. 3];
Bye,
bearophile
Walter:
> On 4/28/2011 11:44 AM, Jens Mueller wrote:
> > Thanks. So if a compiler can assume that pointers do not alias it can
> > generate much better code. What's D's standpoint on that matter then?
> > C99 has restrict. I never came across something similar in D.
>
> Const and immutable.
I do
Timon Gehr wrote:
> > That allows specifying that the memory pointed to is only readable which
> > enables doing the optimizations. But what if the memory is writable but
> > I can my sure that the pointers pointing to it will never alias? How do
> > I pass that information to the compiler?
> >
> >
> That allows specifying that the memory pointed to is only readable which
> enables doing the optimizations. But what if the memory is writable but
> I can my sure that the pointers pointing to it will never alias? How do
> I pass that information to the compiler?
>
> Jens
assert(p1 != p2); (or a
Walter Bright wrote:
> On 4/28/2011 11:44 AM, Jens Mueller wrote:
> >Thanks. So if a compiler can assume that pointers do not alias it can
> >generate much better code. What's D's standpoint on that matter then?
> >C99 has restrict. I never came across something similar in D.
>
> Const and immutab
On 4/28/2011 11:44 AM, Jens Mueller wrote:
Thanks. So if a compiler can assume that pointers do not alias it can
generate much better code. What's D's standpoint on that matter then?
C99 has restrict. I never came across something similar in D.
Const and immutable.
Andrei Alexandrescu wrote:
> On 4/28/11 12:57 PM, Jens Mueller wrote:
> >Walter Bright wrote:
> >>On 4/28/2011 9:19 AM, Daniel Gibson wrote:
> >>>But there's no need for a D compiler to optimize loops that just copy
> >>>parts of an array into another array (and similar stuff), because in D
> >>>yo
16 matches
Mail list logo