空基本优化MSVC [英] Empty Base Optimisation MSVC

查看:110
本文介绍了空基本优化MSVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

具有多继承的空基本优化在msvc ++ 2010中似乎仍然被破坏。目前,它似乎只适用于派生自的第一个类型,所以如果你是从多个空基础派生,子类型最终有更多的字节

Empty base optimisation with multiple inheritance appears still to be broken in msvc++ 2010. Currently, it appears to only work for the first type derived from, so if you are deriving from multiple empty bases the child type ends up with more bytes (just useless padding!) than it needs.

显然,这已经是这种方式了一段时间: https://connect.microsoft.com/VisualStudio/feedback/details/100686/empty-member-optimization-not-工作正常

Apparently it's been this way for some time: https://connect.microsoft.com/VisualStudio/feedback/details/100686/empty-member-optimization-not-working-properly

此链接标记为已关闭 - 不可修复。

This link is marked "closed - not to be fixed". Just wondering if anyone knew if there's anything happening with this "feature" these days??

推荐答案


具有多重继承的空基本优化在msvc ++ 2010中仍然会出现。

Empty base optimisation with multiple inheritance appears still to be broken in msvc++ 2010

broken是什么意思?那么,它不是标准符合吗?

What do you mean by "broken"? That, it is not Standard conformant?

标准不要求空类在从它们派生时具有零大小。实现可以选择优化这个或它可能根本不。

The Standard doesn't require empty classes to have zero size when deriving from them. An implementation may choose to optimize this or it may not at all.

这篇关于空基本优化MSVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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