开发者

When to use void[] vs. ubyte[] in D

开发者 https://www.devze.com 2023-03-28 02:53 出处:网络
Is there a general rule as to开发者_StackOverflow when I should use void[] instead of ubyte[]? Is either preferred?void[] for data that may contain pointers, byte[] for data that\'s actually just data

Is there a general rule as to开发者_StackOverflow when I should use void[] instead of ubyte[]? Is either preferred?


void[] for data that may contain pointers, byte[] for data that's actually just data, like network buffers or files. (I realize Phobos is inconsistent on this)

The reasoning is that the GC scans void[]s for pointers, but not ubyte[]s.


Check out this discussion:

http://www.digitalmars.com/d/archives/digitalmars/D/learn/272.html

0

精彩评论

暂无评论...
验证码 换一张
取 消