Is D's pointer subtraction more permissive than C (and C++)?

Paul Backus snarwin at gmail.com
Sun Apr 3 13:41:02 UTC 2022


On Sunday, 3 April 2022 at 12:22:22 UTC, Tobias Pankrath wrote:
> On Saturday, 2 April 2022 at 18:54:58 UTC, Walter Bright wrote:
>> You're right that the spec should add some commentary saying 
>> that pointer arithmetic should be confined to being within the 
>> same memory object.
>
> What's the definition of memory object here? Does the C 
> Standard treat malloc/calloc and co as special functions and 
> memory objects are what is returned by them?

In C: http://port70.net/~nsz/c/c11/n1570.html#3.15

In D: https://dlang.org/spec/intro.html#object-model


More information about the Digitalmars-d mailing list