你会使用一个非常低级的C ++库吗? [英] Would you use a very low-level C++ library?
问题描述
我几乎准备发布我的C ++内存分配器的初始原型
库:
http://groups.google.com/group/comp....eee1f61fdbb52c
无论如何,我认为我的C编程技能是强制的。进入我的
当前设计。是的,它的核心是低级别的,但我想得到一些
你对仅使用裸骨的问题的看法。 C ++
语言;认为嵌入式,嵌入式,嵌入式! ; ^)
那么,您对使用包含
的C ++库绝对没有模板或异常的感觉如何?
对所讨论的库进行成像,提供了各种基本和低级的b $ b接口。类似于
之类的指针 - 填充内容的东西:
<非常粗糙的伪代码>
struct DoubleLink {
DoubleLink * m_Next;
DoubleLink * m_Prev;
};
class DoubleList {
DoubleLink * m_Front;
DoubleLink * m_Back;
public:
DoubleList():m_Front(0 ),m_Back(0){}
public:
void PushFront(DoubleLink * Link){
//。
}
无效PushBack(DoubleLink * Link){
//。
}
DoubleLink * Pop(DoubleLink * Link){
//。
返回链接;
}
DoubleLink * PopFront(){
返回Pop(m_Front);
}
DoubleLink * PopBack(){
返回Pop(m_Back);
}
void MergeFront(DoubleList * Src){
// ..
}
void MergeBack(DoubleList * Src){
// ..
}
};
所有这些指针都会吓到最多C ++程序员走了?我不是一个好的b $ b巨魔。我只是想知道可用和/或流行的方式。一个C ++库
面向嵌入式环境是什么?
有多少C ++程序员会说我的库是fuc $ king CRAP因为它是
使用没有模板?
我是一名C程序员,我不喜欢我的硬核 C ++的技能很多。幸运的是对我来说! C ++可以是所谓的完美适合我。我在
模板之前管理了
来构建85%的我的分配器,并且所有那些花哨的东西都发挥了作用。
我想废弃C的C ++项目。但是,我认为嘿!我没有必要滥用现金C ++语言的每一个功能。我是C;因此我在裸机级别使用C ++
,适用于嵌入式和操作系统级别的工作。
我真的可以通过这种方式使用或误用!,C ++吗?
或者,我是否应该按照我最初的要求切换到C?
我在C ++处于一个不错的低级别时非常舒服。我可以在没有
模板的情况下使用RAII。我可以使用封装而无需任何模板花式仿函数
类。
ect.ect。
鼓励和欢迎任何想法/建议/意见!
PS
这不是一次拖钓尝试!!!
请耐心等待这里。我很乐意掌握 C ++在更高的杠杆,
但是,目前,我在家里有老派的香草C ++风格。
没有模板,还有很多指针! br $>
:^ O
???
提前感谢您的所有时间。现在尽量不要让我太棒了!
:^)
I am almost ready to post an initial prototype of my C++ memory allocator
library:
http://groups.google.com/group/comp....eee1f61fdbb52c
Anyway, I think my C programming skills are "forceing" there way into my
current design. Yes, it''s low-level at its core, but I want to get some of
your thoughts on the issue of using only the "bare-bones" of the C++
language; think embedded, embedded, embedded! ;^)
Well, how would you feel about actually using a C++ library that contained
absolutely NO templates or exceptions?
Imaging the library in question provided a vary basic and "low-level"
interface. Something along the lines of pointer-FILLED stuff like the
following:
<very crude pseudo-code>
struct DoubleLink {
DoubleLink *m_Next;
DoubleLink *m_Prev;
};
class DoubleList {
DoubleLink *m_Front;
DoubleLink *m_Back;
public:
DoubleList() : m_Front(0), m_Back(0) {}
public:
void PushFront(DoubleLink *Link) {
//.
}
void PushBack(DoubleLink *Link) {
//.
}
DoubleLink* Pop(DoubleLink *Link) {
//.
return Link;
}
DoubleLink* PopFront() {
return Pop(m_Front);
}
DoubleLink* PopBack() {
return Pop(m_Back);
}
void MergeFront(DoubleList *Src) {
//..
}
void MergeBack(DoubleList *Src) {
//..
}
};
Would all of those pointers scare most C++ programmers away? I am NOT a
troll. I simply want to know how "useable and/or popular" a C++ library
geared towards the embedded environment is?
How many C++ programmers would say my library is fuc$king CRAP because it
uses no templates?
I am a C programmer at heart and I don''t like my "hard-core" C++ skills that
much. Luckily for me! C++ can be a so-called perfect fit for me. I managed
to build 85% of my allocator in pure standard old-school C++, before
templates, and all that fancy stuff came into play.
I wanted to scrap the C++ project for C. But, I figured HEY! I don''t HAVE to
misuse every feature of the modern C++ language. I am C; therefore I use C++
at bare bones level, suitable for embedded and operating system level work.
Can I actually get away with using, or misusing!, C++ this way?
Or, should I follow my initial urges to switch to C?
I am 100% comfortable with C++ at a nice low-level. I can use RAII without
templates. I can use encapsulation without any template fancy functor
classes.
ect.ect.
Any thoughts/suggestions/comments are encouraged and welcome!
P.S.
This is not a trolling attempt!!!
Please bear with be here. I would love to "master" C++ at a higher lever,
but, for the moment, I am right at home with old-school vanilla C++ style.
No templates, and TONS of pointers!
:^O
???
Thanks for all of your time in advance. Now try not to flame me too BAD!
:^)
推荐答案
王CRAP因为它
不使用模板吗?
我是C程序员,我不喜欢我的硬核 C ++的技能很多。幸运的是对我来说! C ++可以是所谓的完美适合我。我在
模板之前管理了
来构建85%的我的分配器,并且所有那些花哨的东西都发挥了作用。
我想废弃C的C ++项目。但是,我认为嘿!我没有必要滥用现金C ++语言的每一个功能。我是C;因此我在裸机级别使用C ++
,适用于嵌入式和操作系统级别的工作。
我真的可以通过这种方式使用或误用!,C ++吗?
或者,我是否应该按照我最初的要求切换到C?
我在C ++处于一个不错的低级别时非常舒服。我可以在没有
模板的情况下使用RAII。我可以使用封装而无需任何模板花式仿函数
类。
ect.ect。
鼓励和欢迎任何想法/建议/意见!
PS
这不是一次拖钓尝试!!!
请耐心等待这里。我很乐意掌握 C ++在更高的杠杆,
但是,目前,我在家里有老派的香草C ++风格。
没有模板,还有很多指针! br $>
:^ O
???
提前感谢您的所有时间。现在尽量不要让我太棒了!
:^)
king CRAP because it
uses no templates?
I am a C programmer at heart and I don''t like my "hard-core" C++ skills that
much. Luckily for me! C++ can be a so-called perfect fit for me. I managed
to build 85% of my allocator in pure standard old-school C++, before
templates, and all that fancy stuff came into play.
I wanted to scrap the C++ project for C. But, I figured HEY! I don''t HAVE to
misuse every feature of the modern C++ language. I am C; therefore I use C++
at bare bones level, suitable for embedded and operating system level work.
Can I actually get away with using, or misusing!, C++ this way?
Or, should I follow my initial urges to switch to C?
I am 100% comfortable with C++ at a nice low-level. I can use RAII without
templates. I can use encapsulation without any template fancy functor
classes.
ect.ect.
Any thoughts/suggestions/comments are encouraged and welcome!
P.S.
This is not a trolling attempt!!!
Please bear with be here. I would love to "master" C++ at a higher lever,
but, for the moment, I am right at home with old-school vanilla C++ style.
No templates, and TONS of pointers!
:^O
???
Thanks for all of your time in advance. Now try not to flame me too BAD!
:^)
Chris Thomasson写道:
Chris Thomasson wrote:
我几乎准备发布我的C ++内存分配器的初始原型
库:
http://groups.google.com/group/comp....eee1f61fdbb52c
无论如何,我认为我的C编程技巧是强制的。进入我的
当前设计。是的,它的核心是低级别的,但我想得到一些
你对仅使用裸骨的问题的看法。 C ++
语言;认为嵌入式,嵌入式,嵌入式! ; ^)
那么,您对使用包含
的C ++库绝对没有模板或例外的感觉如何?
>
对相关库进行成像,提供了基本变化的低级
界面。有点像指针那样的东西,比如下面的
:
I am almost ready to post an initial prototype of my C++ memory allocator
library:
http://groups.google.com/group/comp....eee1f61fdbb52c
Anyway, I think my C programming skills are "forceing" there way into my
current design. Yes, it''s low-level at its core, but I want to get some of
your thoughts on the issue of using only the "bare-bones" of the C++
language; think embedded, embedded, embedded! ;^)
Well, how would you feel about actually using a C++ library that contained
absolutely NO templates or exceptions?
Imaging the library in question provided a vary basic and "low-level"
interface. Something along the lines of pointer-FILLED stuff like the
following:
不是我,指针属于C,C ++有更安全的方式处理资源。
-
Ian Collins。
Not me, pointers belong in C, C++ has safer ways of handling resources.
--
Ian Collins.
" Ian Collins" < ia ****** @ hotmail.comwrote in message
news:58 ************** @ mid.individual.net ...
"Ian Collins" <ia******@hotmail.comwrote in message
news:58**************@mid.individual.net...
Chris Thomasson写道:
Chris Thomasson wrote:
>我几乎准备发布我的C ++内存的初始原型分配器
库:
>I am almost ready to post an initial prototype of my C++ memory allocator
library:
[...]
[...]
>在C中,C ++具有更安全的资源处理方式。
>in C, C++ has safer ways of handling resources.
同意。我的原型分配器的源代码广泛使用了
RAII。我恰好没有在
原型制作过程的这个阶段使用模板;这就是全部...而且,我不会使用例外。我希望
分配器能够适应各种低级嵌入式分配器。环境。
我知道C可以做到,我知道C ++可以做得更好......好吧,C代码就像它b / b
一样。当你在低级别使用它时,C ++就像它一样。 C ++不是它,当它自动时,恕我直言,恕我直言,并且PURELY偏见C透视。为您的抽象数据结构添加函数
指针表!虚拟表在C中随处可用
:
http://groups.google.com/group/comp....f857051ca4029b
C ++是一样的根本的方式......聪明的模板技巧很有趣:
http://groups.google.com/group/comp....305cb99ad5a24b
我可以做到这一点我猜猜......但是,我正在处理一种
实施。问题。想想你的公司希望不希望任何方面
的源代码公开...模板技术上确实公开
所谓的源代码给公众...我知道C ++和汇编语言是正确答案我现在在做什么,恕我直言,汇编,然后C是
完美......但是C ++是完全相同的方式......打字少,心情舒畅
RAII带来的
......
; ^)
我通过定制多个所谓的来使用RAII。帮助对象
允许我公平地定制即时资源管理的各个方面作为一个
整个。
我的目标是嵌入式东西因为创建的内存分配器算法可以完全基于构成应用程序线程堆栈下数据结构的内存。
想想一个不支持堆的环境。我可以根据线程专用和备用来做内存
分配器。堆栈空间。 C ++足够低,足以完成工作。 C很好。 C ++可以像
低级别一样,也有点限制......当然C ++的便利性
(例如,RAII)可以用在低位-level没有添加不必要的
开销。模板与一个非常糟糕的编译器混合在技术上可能会产生膨胀。然而,这显然是一个错误和/或糟糕的编程风格。
我不想使用滥用模板。我对C ++与C的亲密度感到满意。
只是证明了C ++编程语言的灵活性! ; ^)
我可以使用RAII和指针在非常有限的空间内完成工作......
嵌入式C ++,剥离了裸机标准库功能。 ..
在操作系统的早期阶段,例外情况可能不受欢迎
生命周期......幸运的是C ++允许我们在这种情况下使用它;确实没有
的问题。
Agreed. The source-code for my prototype allocator makes extensive use of
RAII. I just happen to not be using templates for this stage of the
prototyping process; that''s all... Also, I don''t use exceptions. I want the
allocator to be able to fit into "various low-level embedded" environments.
I KNOW C can do it, and I know C++ can do it better... Well, C code is as it
is. C++ is as it is when you use it at a low-level. C++ is not at it is,
IMHO and PURELY BIASED C perspective , when it "automatically" adds function
pointer tables to your abstract data-structures! Virtual tables are used
everywhere in C:
http://groups.google.com/group/comp....f857051ca4029b
C++ is the same way at its root... Clever template tricks are fun:
http://groups.google.com/group/comp....305cb99ad5a24b
I can do that I guess... But, then I am dealing with a sort of
"implementation" issue. Think of your company wants does not want any aspect
of the source code to be made public... Templates technically do expose
so-called source-code to the public... I know C++ and Assembly Language is
the right answer for what I am doing now, IMHO, Assembly, then C is
perfect... But C++ is the exact same way... Less typing, and ease of mind
that RAII brings to the table...
;^)
I use RAII by customizing a plurality of "so-called" helper objects that
allow me to fairly customize aspects of immediate resource management as a
whole.
I am targeting embedded stuff because the memory allocator algorithm I
created can be solely based on the memory that makes up the data-structures
under the stacks of your applications threads.
Think of an environment that does not support a heap. I can do memory
allocator based on threads "dedicated and ''spare'' " stack space. C++ is
low-level enough to get the job done. C is good. C++ can be just as
low-level, and a bit more confinement as well... Of course C++ convenience
(e.g., RAII) can be used at a low-level without adding unnecessary
overheads. Templates mixed with a very crappy compiler can technically
produce bloat. However, that''s clearly a bug and/or poor programming style.
I don''t want to use misuse templates. I am happy with C++ closeness with C.
Just a testament to the flexibility of the C++ programming language! ;^)
I can use RAII and pointers to get the job done in a very limited space...
Embedded C++, stripped down bare-bones standard library features...
Exceptions can be frowned upon in the early stages of operating system
lifetimes... Luckily C++ allows us to use it in that type of situation; no
problem indeed.
这篇关于你会使用一个非常低级的C ++库吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!