嵌入式系统中的C ++ STL [英] C++ STL in embedded systems

查看:67
本文介绍了嵌入式系统中的C ++ STL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在开发中使用C ++ STL是否有任何限制/问题

嵌入式系统?

特别是:

* STL需要太多空间/内存?

* STL算法/方法的实现是'可重新输入/可重入?

*提供向量连续性的成本是多少记忆?

还有其他任何问题吗?


-

Alex Vinokur

电邮:alex DOT vinokur AT gmail DOT com
http://mathforum.org/library /view/10978.html
http://sourceforge.net/ users / alexvn

Are there any restrictions/problems for use of C++ STL in development
in embedded systems?
In particular:
* Does STL require too much space/memory?
* Is ''implementation of STL algorithms/methods'' reenterable/reentrant?
* What is the cost to provide continuity of vectors in memory?
Any other problems?

--
Alex Vinokur
email: alex DOT vinokur AT gmail DOT com
http://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn

推荐答案

" Alex Vinokur" <人**** @ users.sourceforge.net>在消息中写道

news:11 ********************** @ g14g2000cwa.googlegr oups.com ...
"Alex Vinokur" <al****@users.sourceforge.net> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
在嵌入式系统的开发中使用C ++ STL是否有任何限制/问题?


也许吧。这取决于平台的实施和平台(也许还有其他标准,例如

应用程序的性质)。

特别是:
* STL需要太多的空间/内存吗?


多少钱?另请注意,每个特定的
标准库实现可能会消耗不同的
数量的资源。

*是'STL算法/方法的实现' '可重入/可重入?


这取决于实现。

*在内存中提供向量连续性的成本是多少?


不确定你的意思是什么''连续性''。但是,std :: vector对象的元素

必须在内存中连续。

还有其他任何问题吗?
Are there any restrictions/problems for use of C++ STL in development
in embedded systems?
Perhaps. That depends upon the implementation and
the platform (and perhaps other criteria, such as
the nature of your application).
In particular:
* Does STL require too much space/memory?
How much is too much? Also note that each specific
standard library implementation may consume different
amounts of resources.
* Is ''implementation of STL algorithms/methods'' reenterable/reentrant?
That depends upon the implementation.
* What is the cost to provide continuity of vectors in memory?
Not sure what you mean my ''continuity''. However, the elements
of a std::vector object are required to be contiguous in memory.
Any other problems?



或许。


-Mike



Perhaps.

-Mike


Alex Vinokur写道:
Alex Vinokur wrote:
是否有在嵌入式系统中开发中使用C ++ STL的任何限制/问题?


我觉得我对这里使用的第二个''in'感到困惑。你是说

''for''或''on''?如果您在其他地方开发,然后安装您的程序

以在嵌入式系统上运行,那就是for。如果您尝试编译

程序以便编译器在那里运行,那么它将是on

嵌入式系统。您对哪一个感兴趣?

特别是:
* STL是否需要太多的空间/内存?


你需要定义太多。但是,一般来说,库设计是这样的,对象不会带来巨大的开销。


由于大多数标准库都是模板化的,编译器确实需要

更多的内存用于处理使用模板的代码,而不是代码那些

不能。因此,差异通常存在于编译时,而不是运行时的


* STL算法/方法的实现是'可重新输入/可重入?


一般来说,可能是的。但是,该标准表示非重入

是实现定义的(17.4.4.5)。查看

编译器的文档。

*在内存中提供向量连续性的成本是多少?


我不明白这个问题。矢量是连续的。每个向量

对象都需要一些内存,然后存在一些开销用于动态数组分配。这基本上是成本。

还有其他任何问题吗?
Are there any restrictions/problems for use of C++ STL in development
in embedded systems?
I think I am confused by the use of the second ''in'' here. Do you mean
''for'' or ''on''? If you develop elsewhere and then install your program
to run on an embedded system, that''s "for". If you try to compile your
program so that the compiler is running right there, it would be "on"
an embedded system. Which one are you interested in?
In particular:
* Does STL require too much space/memory?
You need to define "too much". However, generally speaking, the library
design is such that the objects do not introduce enormous overhead.

Since most of the Standard library is templatised, the compiler does need
more memory for processing the code that does use templates than code that
does not. So, the difference usually exists during compile-time and not
in run-time.
* Is ''implementation of STL algorithms/methods'' reenterable/reentrant?
Generally, probably yes. However, the Standard says that non-reentrancy
is implementation-defined (17.4.4.5). Look in the documentation for your
compiler.
* What is the cost to provide continuity of vectors in memory?
I don''t understand the question. Vectors are contiguous. Each vector
object requires some memory for itself and then some overhead exists for
dynamic array allocation. That''s essentially the cost.
Any other problems?




我这里没有答案,但我相信其他人也是嵌入式

系统,做。


V



I have no answer here, but I am sure others who program for embedded
systems, do.

V




Victor Bazarov写道:

Victor Bazarov wrote:
Alex Vinokur写道:
Alex Vinokur wrote:
在嵌入式系统中开发中使用C ++ STL是否存在任何限制/问题?
我认为我在这里使用第二个中感到困惑。你的意思是'''''或''''''?如果你在其他地方开发,然后安装你的程序
在嵌入式系统上运行,那就是for。
Are there any restrictions/problems for use of C++ STL in development
in embedded systems?
I think I am confused by the use of the second ''in'' here. Do you mean
''for'' or ''on''? If you develop elsewhere and then install your program
to run on an embedded system, that''s "for".




它应该是''对于''。

谢谢。

如果你试图编译你的
程序以便编译器在那里运行,那么它将是on<一个嵌入式系统。您对哪一个感兴趣?



It should be ''for''.
Thanks.
If you try to compile your
program so that the compiler is running right there, it would be "on"
an embedded system. Which one are you interested in?

特别是:
* STL是否需要太多空间/内存?
您需要定义太多。
In particular:
* Does STL require too much space/memory?
You need to define "too much".




我想知道使用STL for

嵌入式系统的人的经验。

是否有与问题相关的硬/不可解决的问题?

但是,一般来说,库设计是这样的,对象不会带来巨大的开销。

标准库是模板化的,编译器确实需要更多的内存来处理使用模板的代码而不是代码。因此,差异通常存在于编译时,而不是在运行时。



I would like to know of experience of people working with STL for
embedded systems.
Are there hard/insoluble problems related to issue?
However, generally speaking, the library
design is such that the objects do not introduce enormous overhead.

Since most of the Standard library is templatised, the compiler does need
more memory for processing the code that does use templates than code that
does not. So, the difference usually exists during compile-time and not
in run-time.

* STL算法/方法的实现是''可重新输入/重入?
* Is ''implementation of STL algorithms/methods'' reenterable/reentrant?



一般来说,可能是的。但是,标准规定非重入性是实现定义的(17.4.4.5)。查看
编译器的文档。



Generally, probably yes. However, the Standard says that non-reentrancy
is implementation-defined (17.4.4.5). Look in the documentation for your
compiler.

*在内存中提供向量连续性的成本是多少?
* What is the cost to provide continuity of vectors in memory?



我不明白这个问题。矢量是连续的。每个向量对象都需要一些内存,然后为动态数组分配存在一些开销。这基本上就是成本。



I don''t understand the question. Vectors are contiguous. Each vector
object requires some memory for itself and then some overhead exists for
dynamic array allocation. That''s essentially the cost.




设v为vector< in>类型。

例如,目前v.size()= 10000.

现在我们做以下事情:

for(int i; i< 20000; i ++)v.push_back(i);


必须''v''被重新分配/复制以提供其对v.size()的连续性/>
== 30000.


PS顺便说一下,普通的

阵列是否存在类似的连续性问题?

[snip]


Alex Vinokur

电子邮件:alex DOT vinokur AT gmail DOT com
http ://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn



Let v be of vector<in> type.
For instance, at the moment v.size() = 10000.
Now we do the following thing:
for (int i; i < 20000; i++) v.push_back(i);

Must ''v'' be reallocated/copied to provide its continuity for v.size()
== 30000.

P.S. By the way, does similar continuity problem exist for ordinary
array?
[snip]

Alex Vinokur
email: alex DOT vinokur AT gmail DOT com
http://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn


这篇关于嵌入式系统中的C ++ STL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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