Skip to content

Conversation

@WalterBright
Copy link
Member

No description provided.

{
int i;
int* f;
scope int** x = &f;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit surprising that this doesn't work, because lifetime(x) < lifetime(f). Also int i; scope int* p = &i; on it's own does work, doesn't it?

If lifetime(*x) simply was defined as lifetime(x), there wouldn't be a way to escape the pointer to f, but I'm not sure how much DIP1000 still relates to any of the implementation at this point.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does work. It's the next line that fails (because now f cannot be scope).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I meant was that transitivity could work here, i.e. a scope pointer to a scope pointer, exactly b/c lifetime(x) < lifetime(f)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants