我在哪里将托管类的代码放在托管C ++中 [英] Where do I put the code for managed classes in managed C++

查看:87
本文介绍了我在哪里将托管类的代码放在托管C ++中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我注意到,与C#不同,托管C ++仍然使用标头和实现

文件。我的问题是,对于在何处放置托管类的

实现有什么共识?


在我的项目中,我把所有东西放在头文件中。我没有看到需要将b $ b放在一个单独的实现文件中。


有什么想法吗?


谢谢,

-

Tom Tempelaere。

解决方案



" TT(Tom Tempelaere)" < _ | \ | _0

2P @ | / \ |蒂蒂____ AThotmailD.Tcom|/\|@P

0_ | \\ \\ | _>

在留言中写道:29 ******************************** ** @ microsof t.com ...

大家好,

我注意到,与C#不同,托管C ++仍然使用标题和
实现
文件。我的问题是,对于将托管类的
实现放在何处有任何共识吗?

在我的项目中,我将所有内容放在头文件中。我没有看到需要
把它放在一个单独的实现文件中。

有什么想法吗?




这只是一个风格问题。


将所有成员定义放在头文件中会使它们隐含地内联,但是最好的是内联由JIT完成并发生

无论函数是否被标记为内联,它都不清楚

这真的是一个重要因素。


可能的情况是,将所有实现放在头文件中

会导致生成时间变慢,因为项目变大 - 这个'一个

优势旧的头文件/实现文件技术仍然具有超过

的C#/ Java一体文件模型。


-cd


Hey everyone,

I noticed that unlike C#, managed C++ still uses headers and implementation
files. My question is, is there any consensus of where to put the
implementation of the managed class?

In my project, I put everything in the header file. I don''t see the need to
put it in a seperate implementation file.

Any thoughts?

Thanks,
--
Tom Tempelaere.

解决方案


"TT (Tom Tempelaere)" <_|\|_0


P@|/\|titi____AThotmailD.Tcom|/\|@P


0_|\|_>
wrote in message news:29**********************************@microsof t.com...

Hey everyone,

I noticed that unlike C#, managed C++ still uses headers and
implementation
files. My question is, is there any consensus of where to put the
implementation of the managed class?

In my project, I put everything in the header file. I don''t see the need
to
put it in a seperate implementation file.

Any thoughts?



It''s just a question of style.

Putting all your member definitions in the header file makes them implicitly
inline, but given that most inlining is done by the JIT and happens
regardless of whether the function was marked as inline, it''s not clear that
that''s really a significant factor.

It''s likely the case that putting all the implementation in the header file
will result in slower build times as the project gets larger - that''s one
advantage the old header file/implementation file technique still has over
the C#/Java all in one file model.

-cd


这篇关于我在哪里将托管类的代码放在托管C ++中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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