C ++变成了什么? [英] What has C++ become?

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

问题描述

我今天正在查看某人的C ++代码,尽管我自己编写了完全可读的C ++代码,但是我所看到的东西比法律上更糟糕了。

指导C ++开发的人们b / b
确实搞得一团糟,我的意思是模板

和竞争库以及所有只是渲染

代码无法理解。当然有

会有一定的复杂性,

这是给定的,但如果代码不可读除了

a那种神职人员然后有什么问题

语言。当然,我认为我看到的代码可能是故意混淆

,这样开发人员可以保持对它的控制,

但是不应该设计语言(或它的库)

来防止这种情况吗?

I was looking over someone''s C++ code today and despite
having written perfectly readable C++ code myself,
the stuff I was looking at was worse than legalese.
The people who are guiding the development of C++
have really made a mess of things, I mean templates
and competing libraries and all that just render the
code impossible to comprehend. Sure there is
going to be a certain amount of complexity,
that''s a given, but if code is not readable except by
a kind of clergy then there is something wrong with
the language. Of course, I suppose the code I was
looking at could have been deliberately obfuscated
so that the developer could maintain control over it,
but shouldn''t a language (or its libraries) be designed
to prevent that?

推荐答案

5月31日, 12:36 pm,很多... @ yahoo.com写道:
On May 31, 12:36 pm, plenty...@yahoo.com wrote:

今天我正在查看某人的C ++代码,尽管

我自己编写了完全可读的C ++代码,

我所看到的东西比法律术语更差。

指导C ++开发的人们

确实搞得一团糟,我的意思是模板

和竞争库以及只是渲染

代码无法理解的东西。当然有

会有一定的复杂性,

这是给定的,但如果代码不可读除了

a那种神职人员然后有什么问题

语言。当然,我认为我看到的代码可能是故意混淆

,这样开发人员可以保持对它的控制,

但不应该设计语言(或其库)

以防止这种情况发生?
I was looking over someone''s C++ code today and despite
having written perfectly readable C++ code myself,
the stuff I was looking at was worse than legalese.
The people who are guiding the development of C++
have really made a mess of things, I mean templates
and competing libraries and all that just render the
code impossible to comprehend. Sure there is
going to be a certain amount of complexity,
that''s a given, but if code is not readable except by
a kind of clergy then there is something wrong with
the language. Of course, I suppose the code I was
looking at could have been deliberately obfuscated
so that the developer could maintain control over it,
but shouldn''t a language (or its libraries) be designed
to prevent that?



不是每个人都是一个优秀的C ++作家。它是两件事的组合:


1)一个人没有尽可能有效地使用这种语言(而且很多人没有你的b $ b除了接受它之外它可以做到这一点

不可避免)。一个可怜的法律作家可能会产生异常不清楚的法律文件(一些法律文章比其他人更容易理解)。


2)能够很好地阅读它(一旦你看到足够奇怪的外观

代码它开始变得更有意义并且看起来并不令人困惑)。一个经验丰富的经验丰富的律师甚至可以阅读最麻烦的法律文件

而不会有太大问题。


最好的东西可以要做到这一点,以防止这就是为了解决问题

来源(#1)。而不是像新闻组那样拖拽新闻组,而不是任何帮助,而是在他们的代码中寻找有合法问题的人并给他们建设性的 $ b b / b
批评和建议。


Jason

Not everybody is a good C++ writer. It''s a combination of two things:

1) A person not using the language as effectively as possible (and for
many people there is nothing you can do about it other than accept it
as inevitable). A poor legal writer can produce unusually unclear
legal documents (some legalese is easier to understand than others).

2) The ability to read it well (once you see enough strange looking
code it starts to make more sense and doesn''t look as confusing). An
experienced lawyer can read even the most obtuse legalese document
without much of a problem.

The best thing that can be done to prevent that is to stop the problem
at it''s source (#1). Rather than trolling newsgroups with questions
like this, which don''t help anything at all, instead look for people
with legitimate problems in their code and give them constructive
criticism and suggestions.

Jason


On 2008-05-31 18:36,< a href =mailto:pl ******* @ yahoo.com> pl ******* @ yahoo.com 写道:
On 2008-05-31 18:36, pl*******@yahoo.com wrote:

今天我正在查看某人的C ++代码,尽管我自己编写了完全可读的C ++代码,但是我看到的东西比b $ b更糟糕。 legalese。

指导C ++开发的人们b / b
确实搞得一团糟,我的意思是模板

和竞争库以及只是渲染

代码无法理解。
I was looking over someone''s C++ code today and despite
having written perfectly readable C++ code myself,
the stuff I was looking at was worse than legalese.
The people who are guiding the development of C++
have really made a mess of things, I mean templates
and competing libraries and all that just render the
code impossible to comprehend.



当然,模板在习惯之前可能有点难以阅读

(模板元编程更难)但是考虑到它们的功能有多强大,我认为它们并不过分复杂。


至于竞争库,这是所有适度的东西。 b $ b成功的语言必须处理。总有人会认为标准库不够好并开始自己拥有的b $ b。在某些语言中,使用多个标准库会更糟糕。

Sure, templates can be a bit hard to read before you get used to them
(and template meta-programming even harder) but considering how powerful
they are I do not think they are overly complex.

As for competing libraries, that is something that all moderately
successful languages have to deal with. There are always someone who
thinks that the standard libraries are not good enough and starts their
own. In some languages it is even worse with multiple standard libraries.


当然有

会有一定的复杂性,

这是给定的,但是如果代码不可读除了

a类型的神职人员那么

这个语言有问题。
Sure there is
going to be a certain amount of complexity,
that''s a given, but if code is not readable except by
a kind of clergy then there is something wrong with
the language.



如果您不熟悉具有特定域和代码结构的
,那么非平凡系统中的大多数代码都难以阅读。良好的编码

指南和清晰的架构将减轻这一点,但永远不会完全删除它。


-

Erik Wikstr ?? m

Most code in non-trivial systems is hard to read if you are not familiar
with the specific domain and the structure of the code. Good coding
guidelines and a clear architecture will mitigate this but can never
remove it entirely.

--
Erik Wikstr??m


31 Maj,18:36,很多... @ yahoo.com写道:
On 31 Maj, 18:36, plenty...@yahoo.com wrote:

我今天正在查看某人的C ++代码,尽管我自己编写了完全可读的C ++代码,但是b
$ b看起来比法律术语更糟糕了。

指导C ++开发的人们b / b
真的搞了很多东西,我的意思是模板

和竞争库以及只是渲染

代码无法理解的所有内容。当然有

会有一定的复杂性,

这是给定的,但如果代码不可读除了

a那种神职人员然后有什么问题

语言。当然,我认为我看到的代码可能是故意混淆

,这样开发人员可以保持对它的控制,

但不应该设计语言(或其库)

以防止这种情况发生?
I was looking over someone''s C++ code today and despite
having written perfectly readable C++ code myself,
the stuff I was looking at was worse than legalese.
The people who are guiding the development of C++
have really made a mess of things, I mean templates
and competing libraries and all that just render the
code impossible to comprehend. Sure there is
going to be a certain amount of complexity,
that''s a given, but if code is not readable except by
a kind of clergy then there is something wrong with
the language. Of course, I suppose the code I was
looking at could have been deliberately obfuscated
so that the developer could maintain control over it,
but shouldn''t a language (or its libraries) be designed
to prevent that?



现在我不知道你看过什么样的代码,但我记得

我第一次看到C程序:它看起来或多或少像

乱码(我曾经用Pascal变种编程,有一些装配

编织)。几天练习,我发现代码可读,几个月后我甚至比Pascal更喜欢它。

所以这一切都是需要熟悉

语法并熟悉C背后的原理。

我想这是让你烦恼的东西。编写模板化代码

与编写普通代码有些不同:更多必须在编译时使用

,但是当你学习技巧和方法时

的东西可以工作,再也不是那么困难了。

另外,如果你确实看过一些代码,这些代码是库代码或

代码应该是得到许多(可能是旧的)

平台的支持,你可能会看到代码看似有点混乱。

可能,几天解剖代码会让你很好

很舒服:如果没有,欢迎你在这里提问(或者当你的同事给b
。) />

/ Peter

Now I don''t know what kind of code you did look at, but I remember
first time I looked at a C program: it looked more or less like
gibberish (I used to program in a Pascal variant with some assembly
woven in). A few days practice, and I found the code readable, and
after a few months I even liked it better than Pascal.
So what it all came up to was a need to familiarise myself with the
syntax and get acquainted to the principles behind C.
I guess it is the same stuff that troubles you. Writing templated code
is somewhat different from writing normal code: much more must take
place at compile-time, but when you learn the tricks and the way
things work, it is not so difficult again.
Also, if you did look at some code that was either library code or
code that was supposed to be supported to many (possibly old)
platforms, you will likely see code that is seemingly somewhat
obfuscated.
Probably, a few days of dissecting the code will make you well
comfortable with it: if not, you are welcome to ask questions here (or
to your collegues, of course).

/Peter


这篇关于C ++变成了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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