Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What is exactly the difference between type A is access ObjectClass; and type B is access all ObjectClass; In the RM and Rationale only definitions like B are used. Whats the use for A-like definitions ?

A-like rationale RM type Used
0
Posted

What is exactly the difference between type A is access ObjectClass; and type B is access all ObjectClass; In the RM and Rationale only definitions like B are used. Whats the use for A-like definitions ?

0

(Tucker Taft answers) The only difference is that A is more restrictive, and so presumably might catch bugs that B would not. A is a “pool-specific” access type, and as such, you cannot convert values of other access types to it, nor can you use ‘Access to create values of type A. Values of type A may only point into its “own” pool; that is only to objects created by allocators of type A. This means that unchecked-deallocation is somewhat safer when used with a pool-specific type like A. B is a “general” access type, and you can allocate in one storage pool, and then convert the access value to type B and store it into a variable of type B. Similarly, values of type B may point at objects declared “aliased.” When using class-wide pointer types, type conversion is sometimes used for “narrowing.” This would not in general be possible if you had left out the “all” in the declaration, as in the declaration of A. So, as a general rule, access-to-classwide types usually need to be general ac

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.