当前位置:网站首页>d的破坏与安全
d的破坏与安全
2022-06-22 13:08:00 【fqbqrr】
原文
因为use包含destroy,所以不能为安全
R use(R, T)(T obj, R delegate(T) fT)
{
scope (exit)
destroy!false(obj);
return fT(obj);
}
如何确保安全调用destroy?
只要调用它的析构器是@safe的,destroy就应是安全的.
如果析构器是@system,则安全调用代码唯一方法是:(1)确保不违反内存安全调用析构器条件,(2)(用编译时和/或运行时检查)确保满足这些条件,(3)在@trusted函数中包装destroy.
use推导为系统,闭包也未标记为安全.
标记use为安全,来看看说了啥.
对类,当前dmd+druntime不能静态决定析构器是否安全.
边栏推荐
- VR panoramic shooting breaks the deadlock of traditional propaganda that wild geese pass without leaving traces
- Common writing methods and excellent examples of acknowledgments in graduation thesis writing
- 简简单单的科研秘籍
- 成都测试设备开发_单片机C语言之数组介绍
- Tasks and responsibilities of the test team and basic concepts of testing
- How do I open an account on my mobile phone? Is it safe to open an account online?
- HW is around the corner. Can't you read the danger message?
- Eureka的InstanceInfoReplicator类(服务注册辅助类)
- How to protect WordPress websites from cyber attacks? It is important to take safety measures
- transformers VIT图像模型向量获取
猜你喜欢

Database employment consulting system for your help

Neuron+ekuiper realizes data collection, cleaning and anti control of industrial Internet of things

Chip silicon and streaming technology

Kukai TV ADB

Installing and using protobuf-c

BSN发展联盟理事长单志广:DDC可为中国元宇宙产业发展提供底层支撑

融云:让银行轻松上“云”

Talk about row storage and column storage of database

“不敢去懷疑代碼,又不得不懷疑代碼”記一次網絡請求超時分析

JS advanced programming version 4: learning iterators
随机推荐
“不敢去懷疑代碼,又不得不懷疑代碼”記一次網絡請求超時分析
STM32F1与STM32CubeIDE编程实例-光断续传感器驱动
Talk about row storage and column storage of database
如何实现接口异常场景测试?测试方法探索与测试工具实现
Quickly understand the commonly used symmetric encryption algorithm, and no longer have to worry about the interviewer's thorough inquiry
快速了解常用的对称加密算法,再也不用担心面试官的刨根问底
如何给VR全景作品添加遮罩?作用是什么?
JS advanced programming version 4: learning iterators
How to implement interface exception scenario testing? Exploration of test methods and implementation of test tools
hw在即,你还不会看危险报文?
毕业论文写作中致谢词的常见写法及优秀范文
My suggestions on SAP ABAP transformation
Loot、USDT
What is bout?
Transformers vit image model vector acquisition
transformers VIT图像模型向量获取
How maxscale handles event status after MariaDB master-slave switchover -handle_ events
轻松上手Fluentd,结合 Rainbond 插件市场,日志收集更快捷
哈希索引设计发展史
Interpretation of the thesis -- factorization meets the neighborhood: a multifaceted collaborative filtering model