网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
08月19日漏签0天
c吧 关注:133,629贴子:394,138
  • 看贴

  • 图片

  • 吧主推荐

  • 视频

  • 游戏

  • 3回复贴,共1页
<<返回c吧
>0< 加载中...

C代表的是什么含义

  • 只看楼主
  • 收藏

  • 回复
  • 童话好玩
  • 白丁
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
大家说说看吧


  • wangdan1600
  • 白丁
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
complexity problems that he had seen on Multics. After a brief and unsuccessful flirtation with
Fortran, Thompson created the language B by simplifying the research language BCPL [2] so its
interpreter would fit in the PDP-7's 8K word memory. B was never really successful; the hardware
memory limits only provided room for an interpreter, not a compiler. The resulting slow performance
prevented B from being used for systems programming of UNIX itself.
[1] The difficulties involved in learning, using, and implementing PL/I led one programmer to pen this verse:
IBM had a PL/I / Its syntax worse than JOSS / And everywhere this language went / It was a total loss.
JOSS was an earlier language, also not noted for simplicity.
[2] "BCPL: A Tool for Compiler Writing and System Programming," Martin Richards, Proc. AFIPS Spring Joint
Computer Conference, 34 (1969), pp. 557-566. BCPL is not an acronym for the "Before C Programming
Language", though the name is a happy coincidence. It is the "Basic Combined Programming Lan-guage"—
"basic" in the sense of "no frills"—and it was developed by a combined effort of researchers at London
University and Cambridge University in England. A BCPL implementation was available on Multics.

B simplified BCPL by omitting some features (such as nested procedures and some loop-ing
constructs) and carried forward the idea that array references should "decompose" into pointer-plusoffset
references. B also retained the typelessness of BCPL; the only operand was a machine word.
Thompson conceived the ++ and -- operators and added them to the B compiler on the PDP-7. The
popular and captivating belief that they're in C because the PDP-11 featured corresponding autoincrement/
decrement addressing modes is wrong! Auto increment and decrement predate the PDP-11
hardware, though it is true that the C statement to copy a character in a string:
*p++ = *s++;
can be compiled particularly efficiently into the PDP-11 code:
movb (r0)+,(r1)+
leading some people to wrongly conclude that the former was created especially for the latter.
A typeless language proved to be unworkable when development switched in 1970 to the newly
introduced PDP-11. This processor featured hardware support for datatypes of several different sizes,
and the B language had no way to express this. Performance was also a problem, leading Thompson to
reimplement the OS in PDP-11 assembler rather than B. Dennis Ritchie capitalized on the more
powerful PDP-11 to create "New B," which solved both problems, multiple datatypes, and
performance. "New B"—the name quickly evolved to "C"—was compiled rather than interpreted, and
it introduced a type system, with each variable described in advance of use.
Early Experiences with C
The type system was added primarily to help the compiler-writer distinguish floats, doubles, and
characters from words on the new PDP-11 hardware. This contrasts with languages like Pascal, where
the purpose of the type system is to protect the programmer by restricting the valid operations on a



2025-08-19 14:16:39
广告
不感兴趣
开通SVIP免广告
  • wangdan1600
  • 白丁
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
data item. With its different philosophy, C rejects strong typing and permits the programmer to make
assignments between objects of different types if desired. The type system was almost an afterthought,
never rigorously evaluated or extensively tested for usability. To this day, many C programmers
believe that "strong typing" just means pounding extra hard on the keyboard.
Many other features, besides the type system, were put in C for the C compiler-writer's benefit (and
why not, since C compiler-writers were the chief customers for the first few years). Features of C that
seem to have evolved with the compiler-writer in mind are:
• Arrays start at 0 rather than 1. Most people start counting at 1, rather than zero. Compilerwriters
start with zero because we're used to thinking in terms of offsets. This is sometimes
tough on non-compiler-writers; although a[100] appears in the definition of an array, you'd
better not store any data at a[100], since a[0] to a[99] is the extent of the array.
• The fundamental C types map directly onto underlying hardware. There is no built-in
complex-number type, as in Fortran, for example. The compiler-writer does not have to invest
any effort in supporting semantics that are not directly provided by the hardware. C didn't
support floating-point numbers until the underlying hardware provided it.
• The auto keyword is apparently useless. It is only meaningful to a compiler-writer
making an entry in a symbol table—it says this storage is automatically allocated on entering
the block (as opposed to global static allocation, or dynamic allocation on the heap). Auto is
irrelevant to other programmers, since you get it by default.
• Array names in expressions "decay" into pointers. It simplifies things to treat arrays as
pointers. We don't need a complicated mechanism to treat them as a composite object, or
suffer the inefficiency of copying everything when passing them to a function. But don't make
the mistake of thinking arrays and pointers are always equivalent; more about this in Chapter
4.
• Floating-point expressions were expanded to double-length-precision everywhere.
Although this is no longer true in ANSI C, originally real number constants were always
doubles, and float variables were always converted to double in all expressions. The reason,
though we've never seen it appear in print, had to do with PDP-11 floating-point hardware.
First, conversion from float to double on a PDP-11 or a VAX is really cheap: just append an
extra word of zeros. To convert back, just ignore the second word. Then understand that some
PDP-11 floating-point hardware had a mode bit, so it would do either all single-precision or
all double-precision arithmetic, but to switch between the two you had to change modes.
Since most early UNIX programs weren't floating-point-intensive, it was easier to put the box
in double-precision mode and leave it there than for the compiler-writer to try to keep track of
it!
• No nested functions (functions contained inside other functions). This simplifies the
compiler and slightly speeds up the runtime organization of C programs. The exact
mechanism is described in Chapter 6, "Poetry in Motion: Runtime Data Structures."
• The register keyword. This keyword gave the compiler-writer a clue about what
variables the programmer thought were "hot" (frequently referenced), and hence could
usefully be kept in registers. It turns out to be a mistake. You get better code if the compiler
does the work of allocating registers for individual uses of a variable, rather than reserving
them for its entire lifetime at declaration. Having a register keyword simplifies the
compiler by transferring this burden to the programmer.
There were plenty of other C features invented for the convenience of the C compiler-writer, too. Of
itself this is not necessarily a bad thing; it greatly simplified the language, and by shunning
complicated semantics (e.g., generics or tasking in Ada; string handling in PL/I; templates or multiple
inheritance in C++) it made C much easier to learn and to implement, and gave faster performance.
Unlike most other programming languages, C had a lengthy evolution and grew through many
intermediate shapes before reaching its present form. It has evolved through years of practical use into
a language that is tried and tested. The first C compiler appeared circa 1972, over 20 years ago now.
As the underlying UNIX system grew in popularity, so C was carried with it. Its emphasis on lowlevel
operations that were directly supported by the hardware brought speed and portability, in turn
helping to spread UNIX in a benign cycle.


  • 221.131.128.*
快试试吧,
可以对自己使用挽尊卡咯~
◆
◆
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 3回复贴,共1页
<<返回c吧
分享到:
©2025 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示