More ++, Less C

原创 2007年09月13日 11:08:00

Standard template libraries, abstract classes and multiparadigm programming are keys to high performance.

"Too much C++ code is just C. For example, people do class hierarchies in a very naïve way. They think of a few implementation details that are common and they throw them into a base class. I have been preaching about this for nearly 15 years, and nobody listens. It's so much easier to make your own mistakes than to listen," lectured Bjarne Stroustrup, creator of the C++ language in his Tuesday, August 28, 2001 keynote at the Software Development East conference in Boston. Now head of AT&T's Large-Scale Programming Research Department in Florham Park, New Jersey, Stroustrup continues his focus on efficient algorithms and high performance. The solution to the problem of overloaded base classes, said Stroustrup, is to write interfaces that are totally abstract. "Writing code like this is a bit tedious because of the repetition, but if you have a concept, make it a class. This is one way to handle common state."

Beginning his talk with a graph depicting the performance of linear algebra calculations programmed in C++ and Fortran, Stroustrup pointed out that, while beating Fortran at what it does best is difficult, it can be done. "These are my semi-arm-waving comments on efficiency. Efficiency matters—not everywhere, but in embedded systems and performance numerics, which are areas that interest me, it does." What is slowing down C++ coders everywhere? First, too much reinvention of the wheel, he said. "If you think you can build a matrix library, go ahead, but there are many already available." He also lambasted "Smalltalk-style" hierarchies and showed several code snippets explaining how to better manage resources.

"Say you acquire a resource and then you close it out at the end. What if you never get to the end?" he asked rhetorically. "OK, so you open a try block, catch the exception… But there is something fundamentally wrong with this solution. Your code has roughly doubled in size. You're better off creating a class with a destructor." Object-oriented programming, Stroustrup went on to say, is really just one of several paradigms C++ users have at their disposal. Multiparadigm programs that use OO, generic programming and data abstraction are powerful ways to achieve fast performance and power.

"If you were designing C++ today, would you do anything differently?" an audience member asked. "Undoubtedly," responded Stroustrup. "Language design is a response to a set of problems you are facing at a point in time. I would want to support direct representation. I would not, however, build a high-level language and sacrifice efficiency. A lot of times, that question really is, 'Did you really mean to design something like Java but you couldn't?' and the answer is no. In terms of performance, C++ and Java don't mesh. I could make a similar statement about C#, but I won't. You also have to remember that I don't like proprietary languages."

So how will C++ evolve over the next 10 years? "Templated type definitions should be there," Stroustrup predicted. "The main effort should be in standardizing some of the libraries. It's not going to be easy, but I see it as a language that maintains its emphasis on run-time efficiency. The area I'm most interested in is distributed computing. I don't see any real likelihood of changes in C++ for supporting Web development; that belongs in the area of libraries. Whether any such libraries can be standardized is a big question, though. I have my doubts."

—Alexandra Weber Morales
Software Development Magazine

 

linux中cat、more、less命令区别详解

众所周知linux中命令cat、more、less均可用来查看文件内容,主要区别有: cat是一次性显示整个文件的内容,还可以将多个文件连接起来显示,它常与重定向符号配合使用,适用于文件内容少的情况;...
  • xyw_Eliot
  • xyw_Eliot
  • 2013年11月21日 16:58
  • 34792

初学linux命令-more、less

命令五 名称:more   命令功能:用于查看纯文本文件(较长的) 语法:more 选项() [文件] 常用的选项(参数): -数字      功能:预先显示的行数(默认为一页); -d     ...
  • lyt_7cs1dn9
  • lyt_7cs1dn9
  • 2016年05月26日 13:06
  • 750

cat/more/less命令解释与区别

cat 命令是 concatenate 的缩写,表示合并文件,命令格式如下: $ cat  选项  文件名 功能: 1. 合并文件   例如 :   $ cat  test1.txt   test2....
  • u010566813
  • u010566813
  • 2015年01月02日 20:27
  • 798

jQuery——Write less,do more

What is jQuery? jQuery is a fast, small, and feature-rich JavaScript library. Itmakes thing...
  • xdd19910505
  • xdd19910505
  • 2015年04月03日 15:37
  • 1255

more和less命令的具体区别

more不可以回去,就是不可以向前,只能向后,况且只能使用Enter和Space向后翻动。 less使用vim中的j,k键盘可以上下翻动,还可以使用上下箭头~~ 它们的相同点就是:那些文件或者文件...
  • baoendemao
  • baoendemao
  • 2014年11月12日 21:11
  • 459

JQuery——Write less,do more

在学JQuery之前,我一直都很好奇这个东西为什么叫JQuery,有疑问就去问百度。 百度上是这样子讲的:jQuery,顾名思义,也就是JavaScript和查询(Query),即是辅助JavaScr...
  • u013044029
  • u013044029
  • 2015年12月15日 15:31
  • 1460

Linux运维必学必会(四)- more、less、tail、head命令的区别

http://my.oschina.net/junn/blog/304868二、more 文件内容或输出查看工具 more 是我们最常用的工具之一,最常用的就是显示输出的内容,然后根据窗口的大小进行分...
  • caib1109
  • caib1109
  • 2016年08月12日 22:37
  • 1054

More is Less——卷积网络加速

一篇讲网络加速的论文,来自2017CVPR。《More is Less: A More Complicated Network with Less Inference Complexitv》Intro...
  • shuzfan
  • shuzfan
  • 2017年04月14日 15:03
  • 3811

linux grep命令 More命令 Less命令 基本使用

1:grep功能介绍(参考:http://www.cnblogs.com/end/archive/2012/02/21/2360965.htm) Linux系统中grep命令是一种强大的文本搜索工具...
  • rnZuoZuo
  • rnZuoZuo
  • 2015年07月14日 11:50
  • 2393

linux中普通的文件查看操作(cat、more、less、head、tail)

cat:基本是最常用的查看文件内容的linux命令。 more 也是用来查看一个文件的内容。当文件内容太多,一屏幕不能占下,而你用cat肯定是看不前面的内容的,那么使用more就可以解决这个问题了。...
  • Songjs19931206
  • Songjs19931206
  • 2015年01月22日 23:12
  • 1078
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:More ++, Less C
举报原因:
原因补充:

(最多只允许输入30个字)