开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜