C需要一个BOOST [英] C needs a BOOST

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

问题描述

如果C能采用一个非常好的算法,那将是非常好的。

库,比如C ++的STL + BOOST。


最近的颠倒这句话中的词语问题发布给了我

考虑一下。

因为所有漂亮的算法所以用C ++做5行就好了

随着语言的出现(我认为BOOST会像STL那样用C ++语言来支持

。)


它还有很多在C中工作而不是C ++。为什么C没有堆栈,

dequeues,以及其标准

库中已有的其他常见简单工具集?


意见?是否保持语言的微不足道的价值C

程序员不得不不断重新发明轮子?

It would be really nice if C could adopt a really nice algorithms
library like C++''s STL + BOOST.

The recent "reverse the words in this sentence" problem posted made me
think about it.
It''s like 5 lines to do it in C++ because of all the nifty algorithms
that come with the language (I think BOOST is going to get bolted on
to the C++ language like STL did).

It''s a lot more work in C than C++. Why doesn''t C have stacks,
dequeues, and other common, simple tool sets already in its standard
library?

Opinions? Is keeping the language tiny worth the cost of C
programmers having to constantly reinvent the wheel?

推荐答案

user923005写道:
user923005 wrote:

如果C可以采用一个非常好的算法那将是非常好的

库像C ++的STL + BOOST 。
It would be really nice if C could adopt a really nice algorithms
library like C++''s STL + BOOST.



你如何在C中实现它?

有没有比将C转换为C ++更简单的解决方案?

(由jacob navia提出的GC和运算符重载不会提供通用的

算法)。

How would you implement that in C?
Is there any solution simplier than transforming C into C++?
(GC and operator overloading proposed by jacob navia won''t provide generic
algorithms).


保持语言微不足道程序员不得不经常重新发明轮子的成本?
Is keeping the language tiny worth the cost of C
programmers having to constantly reinvent the wheel?



保持语言小,使C与C ++不同,那就是''为什么,对于某些项目来说,C

仍然比C ++更好。

另一方面,将C转换为C ++会没有意义,因为它会使C和C ++语言重复。

Keeping the language small makes C different from C++, and that''s why, C
can still be better than C++ for some projects.
On the other hand, transforming C into C++ would be pointless, as it would
make the C and C++ language duplicates.


它在C语言中的工作要比C ++多得多。为什么C没有堆叠,

dequeues,以及其标准

库中已有的其他常见的简单工具集?
It''s a lot more work in C than C++. Why doesn''t C have stacks,
dequeues, and other common, simple tool sets already in its standard
library?



提出可实施的解决方案。理想情况下,有几个成功的实际实现。

那么,我们可以考虑你的报价。


-

如果你有一个不属于Usenet的问题,请联系我

< ta ************** ***@yahoDELETETHATo.fr>

Propose an implementable solution. Ideally, with several successful
real-world implementations.
Then, we may consider your offer.

--
If you''ve a question that doesn''t belong to Usenet, contact me at
<ta*****************@yahoDELETETHATo.fr>


AndréGillibert写道:
André Gillibert wrote:

user923005写道:
user923005 wrote:

>如果C能采用一个非常好的算法库,比如C ++的STL + BOOST那将是非常好的。
>It would be really nice if C could adopt a really nice algorithms
library like C++''s STL + BOOST.



你如何在C中实现它?

有没有比将C转换为C ++更简单的解决方案?

(jacob提出的GC和运算符重载navia不会提供

通用算法。


How would you implement that in C?
Is there any solution simplier than transforming C into C++?
(GC and operator overloading proposed by jacob navia won''t provide
generic algorithms).



您的问题有几种解决方案。通用性。


第一个是在C中使用泛型指针:void *


我已经编写了一个动态表包使用那种方法。你告诉

软件对象的大小,然后你就可以使用它们了。

运算符重载允许你分配和读取数据。


是的,函数返回一个void指针,必须将其转换为

的东西,但这是一个小小的不便。

There are several solutions to your "problem" of genericity.

The first one is the usage of the generic pointer in C: void *

I have written a dynamic table package using that approach. You tell
the software how big your objects are, and then you just use them.
Operator overloading allows you to assign and read the data.

True, the functions return a void pointer that must be casted into
something but that is a minor inconvenience.


>保持语言微不足道是否需要不断重新发明轮子的程序员花费?
>Is keeping the language tiny worth the cost of C
programmers having to constantly reinvent the wheel?



保持语言较小使C与C ++不同,这就是为什么,对于某些项目来说,C

仍然比C ++更好。


Keeping the language small makes C different from C++, and that''s why, C
can still be better than C++ for some projects.



这是一个错误。保持语言处于这种状态会使语言无法用于任何严肃的软件开发

,除非你的项目足够大以保证重写

C库并在每个项目中添加堆栈,列表等等!

This is an error. Keeping the language in this state makes the language
impossible to use for any serious software development
unless your project is big enough to warrant rewriting the
C library and adding stacks, lists, etc etc at each project!


另一方面,将C转换为C ++将毫无意义,因为它

会使C和C ++语言重复。
On the other hand, transforming C into C++ would be pointless, as it
would make the C and C++ language duplicates.



是的。我提议的不是那种。


我只是建议使用运算符重载,这是一种非常常见的

功能,几乎在所有语言中都可以找到,包括FORTRAN, Visual Basic,

C#C ++,你有什么用?

Yes. What I am proposing is nothing of the sort.

I am just proposing using operator overloading, a very common
feature found in almost all languages including FORTRAN, Visual Basic,
C# C++, and what have you!


>这是很多C语言比C ++更多。为什么C不会有堆栈,
出列,以及其标准库中已有的其他常见的简单工具集?
>It''s a lot more work in C than C++. Why doesn''t C have stacks,
dequeues, and other common, simple tool sets already in its standard
library?



建议可实施的解决方案理想情况下,有几个成功的实际实现。


Propose an implementable solution. Ideally, with several successful
real-world implementations.



我已经做到了。

只有火焰随后发生。

I have done just that.
Only flames ensued.


然后,我们可能会考虑您的报价。
Then, we may consider your offer.



您可以考虑我的。它正在工作,它有一个实现,

为什么不看它?


-

jacob navia
jacob at jacob point remcomp point fr

logiciels / informatique
http://www.cs.virginia.edu/~lcc-win32


user923005写道:
user923005 wrote:

如果C可以采用一个非常好的算法那将是非常好的

库像C ++的STL + BOOST。


最近反驳这句话中的单词问题发布给了我

考虑一下。

因为所有漂亮的算法所以用C ++做5行就好了

随着语言的出现(我认为BOOST会像STL那样用C ++语言来支持

。)


它还有很多在C中工作而不是C ++。为什么C没有堆叠,

dequeues,以及其标准

库中已有的其他常见的简单工具集?
It would be really nice if C could adopt a really nice algorithms
library like C++''s STL + BOOST.

The recent "reverse the words in this sentence" problem posted made me
think about it.
It''s like 5 lines to do it in C++ because of all the nifty algorithms
that come with the language (I think BOOST is going to get bolted on
to the C++ language like STL did).

It''s a lot more work in C than C++. Why doesn''t C have stacks,
dequeues, and other common, simple tool sets already in its standard
library?



为什么这必须是语言的一部分?有很多

的第三方API可以帮到你。


有很多理由让语言变小,让

实施者为其客户提供解决方案。

Why does this have to be part of the language? There are plenty of
third-party APIs that give you this.

There are plenty of reasons to keep a language small, and let the
implementors provide solutions for their customers.


这篇关于C需要一个BOOST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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