指向函数和指针的大对象开关 [英] Large Object within Pointer to Function & Switch

查看:83
本文介绍了指向函数和指针的大对象开关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您知道当前的C ++编译器限制为源代码中的64KB段吗?
代码?好消息是Microsoft Visual C ++ 2005在源代码中扩展到4GB

段。 4GB段是使用

指向功能和切换的大对象的理想选择。请列出其他C ++编译器,如果他们

已添加4GB段的支持。

我能够编写65,536个函数和65,536函数的内存地址

存储在指向函数列表的指针中。大概需要256KB。测试

表明65,536个函数中的每个函数都已成功执行

,在调试版本和发布版本中都有正确的结果。

在调试版本中,Switch可以包含65,536个案例,但C ++编译器需要更多的时间来编译,而不是指向函数的指针。不幸的是,它不会在发布版本中编译
。在任何

文档中都找不到未知错误。 (讨论这个问题并不重要。)

我认为最好通过

指向函数列表来编写小函数,而不是在一个大函数中使用大开关。通过

的方式,小函数可以适应缓存。 (正确吗?)。

如果要编写1到268,435,456个函数,

指向函数列表的内存地址最多需要1GB。

我知道你要说什么 - 笑 - 不能做。如果你愿意写复杂的项目,我恳请你

来试试。想想全息

角色,比如星际迷航或者游戏角色想要写的东西。这个

大物体包含身体,包括头部,手臂,腿部和一切。你需要

来编写数百或数千个函数来响应移动的手臂,腿部和头部。

更多的功能可以回应嘴巴说话。

这使得32位CPU机器操作C ++编译器的速度变慢,因为这个64位CPU机器可能正在使用大RAM。


请告诉我你认为最好的做法。通过将/ bigobj和/ Gy添加到Microsoft C ++编译器中来生活大对象

。检查选项

其他C ++编译器的文档。应该在超过100万行源代码中写入指向

函数列表的大指针?或者......将指针列表中的一半

或四分之一函数分成两个或四个模块源代码?


当我感兴趣时,请将我推荐给其他新闻组使用C ++编译器的选项使用优化和性能来处理大量的b $ b对象,但

不仅仅通过Microsoft。请指教。


Bryan Parkoff

Do you know that current C++ Compiler limits to 64KB segments in source
code? It is good news that Microsoft Visual C++ 2005 has expanded to 4GB
segments in source code. 4GB segment is ideal for large object using
pointer to function and switch. Please list other C++ Compilers if they
have added a support of 4GB segments.
I am able to write 65,536 functions and 65,536 function''s memory address
is stored into pointer to function list. It takes about 256KB. The test
has shown that each function out of 65,536 functions have been executed
successfully with correct result in both debug version and release version.
Switch can contain 65,536 cases in debug version, but C++ Compiler takes
more time to compile than pointer to function. Unfortunately, it will not
compile in release version. Unknown error is not found in any
documentation. (Not important to discuss this issue.)
I think that it is best practice to write small functions through
pointer to function list rather than large switch in one big function. By
the way, small functions can fit in cache. (Correct?).
If you are going to write 1 to 268,435,456 functions, memory address in
pointer to function list will take up to 1GB.
I know what you are going to say -- laugh -- can''t be done. I urge you
to try if you are willing to write complex project. Think about holographic
character like Star Trek or character for game what you want to write. This
big object contains body including head, arm, leg, and everything. You need
to write hundred or thousand functions to respond moving arm, leg, and head.
More functions to be responded for mouth talking.
It makes 32-bit CPU machine to be slower to manipulate C++ Compiler for
large object so 64 bit CPU machine may be working with large RAM.

Please tell me what you think the best practice. Live with big object
by adding /bigobj and /Gy to Microsoft C++ Compiler. Check option
documentation for other C++ Compilers. Should write large pointer to
function list in more than 1 million line of source code? Or...Split half
or quarter function to pointer list into two or four module source code?

Please refer me to other newsgroups when I am interested to work large
object using optimization and performance using C++ Compiler''s option, but
not through Microsoft alone. Please advise.

Bryan Parkoff

推荐答案

Bryan Parkoff写道:
Bryan Parkoff wrote:

您知道当前的C ++编译器
Do you know that current C++ Compiler



这是什么?我在哪里可以找到当前的C ++编译器?你是否在讨论标准要求?

What''s that? Where could I find "current C++ Compiler"? Are you
talking of the Standard requirements?


限制为64KB段

源代码?
limits to 64KB segments in
source code?



不,我从来没有听说过这样的事情。但话说再说一遍,我不能声称

我听过一切......然而,标准没有规定这样的

限制。我知道有_minimal_ quantity *推荐*

用于实现,但我找不到源代码中的段。

那些。

No, I never heard of such thing. But then again, I cannot claim
I''ve heard everything... The Standard, however, imposes no such
limitation. I know that there are _minimal_ quantities *recommended*
for implementations, but I can''t find "segments in source code" among
those.


好​​消息是Microsoft Visual C ++ 2005有
It is good news that Microsoft Visual C++ 2005 has



产品特定的讨论通常是偏离主题的。每个

产品最有可能至少有一个专用新闻组。我知道

VC ++肯定会做的,甚至不止一个。

Product-specific discussions are generally off-topic here. Each
product most likely has at least one dedicated newsgroup. I know
that VC++ certainly does, even more than one.


在源代码中扩展到4GB段。 4GB段是使用指针功能和切换的大型对象的理想选择。如果他们添加了4GB段的支持,请列出其他

C ++编译器。
expanded to 4GB segments in source code. 4GB segment is ideal for
large object using pointer to function and switch. Please list other
C++ Compilers if they have added a support of 4GB segments.



请列出您想要了解的操作系统。那么请

意识到特定于OS的讨论也是偏离主题的。

是这些东西的新闻组。

Please list operating systems you want to learn about. Then please
realise that discussions specific to OS are also off-topic. There
are newsgroups for those things.


[..]

请在转到其他新闻组时我有兴趣使用C ++编译器的

选项使用优化和性能来工作
大对象,但不是仅通过Microsoft。请指教。
[..]
Please refer me to other newsgroups when I am interested to work
large object using optimization and performance using C++ Compiler''s
option, but not through Microsoft alone. Please advise.



尝试''comp.os.ms-windows.programmer。*''hierarchy或''microsoft.public。*''

层次结构。


V

-

请在通过电子邮件回复时删除资金'A' br />
我没有回复最热门的回复,请不要问

Try ''comp.os.ms-windows.programmer.*'' hierarchy or ''microsoft.public.*''
hierarchy.

V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask


Bryan Parkoff写道:
Bryan Parkoff wrote:

您是否知道当前的C ++编译器限制为源代码中的64KB段

代码?好消息是Microsoft Visual C ++ 2005在源代码中扩展到4GB

段。 4GB段是使用

指向功能和切换的大对象的理想选择。请列出其他C ++编译器,如果他们

已添加4GB段的支持。
Do you know that current C++ Compiler limits to 64KB segments in source
code? It is good news that Microsoft Visual C++ 2005 has expanded to 4GB
segments in source code. 4GB segment is ideal for large object using
pointer to function and switch. Please list other C++ Compilers if they
have added a support of 4GB segments.



phuff - gcc支持9,223,372,036,854,775,807个字节段。


现在我正在寻找一台拥有那么多内存的计算机,一个可以在几秒钟内写完所有的b $ b。

phuff - gcc supports 9,223,372,036,854,775,807 byte segments.

Now I''m looking for a computer with that much memory, one that can write
to all of it in a few seconds.


Gianni Mariani< gi ***** **@mariani.wswrote:
Gianni Mariani <gi*******@mariani.wswrote:

> Bryan Parkoff写道:
>Bryan Parkoff wrote:


>您是否知道当前的C ++编译器限制为源代码中的64KB段?好消息是,Microsoft Visual C ++ 2005已经扩展到源代码中的4GB段。 4GB段是使用指向功能和切换的大对象的理想选择。如果他们已经添加了4GB段的支持,请列出其他C ++编译器。
> Do you know that current C++ Compiler limits to 64KB segments in source
code? It is good news that Microsoft Visual C++ 2005 has expanded to 4GB
segments in source code. 4GB segment is ideal for large object using
pointer to function and switch. Please list other C++ Compilers if they
have added a support of 4GB segments.


> phuff - gcc支持9,223,372,036,854,775,807个字节段。
>phuff - gcc supports 9,223,372,036,854,775,807 byte segments.



你们如何定义细分?


史蒂夫

How are you guys defining "segment"?

Steve

这篇关于指向函数和指针的大对象开关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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