access参数模式的用处是什么? [英] What is the usefulness of the `access` parameter mode?

查看:95
本文介绍了access参数模式的用处是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Ada中有三种正常"的参数传递模式:inoutin out. 但是还有第四个模式,access有什么需要它们的地方吗? (即原本不可能的事情.)

There are three 'normal' modes of passing parameters in Ada: in, out, and in out. But then there's a fourth mode, accessis there anything wherein they're required? (i.e. something that would otherwise be impossible.)

现在,我确实知道GNAT JVM Ada编译器在导入的[库]规范中大量使用了它们. (此外,可以说它们对于C/C ++翻译是必不可少的.)

Now, I do know that the GNAT JVM Ada-compiler makes pretty heavy use of them in the imported [library] specifications. (Also, they could arguably be seen as essential for C/C++ translations.)

推荐答案

访问模式的主要驱动因素之一是解决在Ada 2012之前功能参数只能为in模式的限制.

One of the primary drivers of the access mode was to work-around the restriction that, prior to Ada 2012, function parameters could only be of mode 'in'.

因此,尽管仍然有某些领域是适当的解决方案,也许是在绑定中,但Ada 2012放宽了允许的函数参数模式,使其现在包括"in out",这可能会大大减少对访问模式的需求.

So while there may still be areas where they're an appropriate solution, perhaps in bindings, Ada 2012's relaxation of the allowed function parameters modes to now include 'in out' will probably significantly reduce the need for access mode.

这篇关于access参数模式的用处是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆