系统与程序设计(一)

1.What is the maximum value for a long int? (hint: 32 bits)
ans:2147483647 or 0x7fffffff.
solution:关于int 和 long int,在VC下没有区别。两种类型均用4个字节存放数据。但是最高位是符号位,所以最高位是0,其他都是1.

2.When was C born?
C is quirky, flawed(有缺陷的), and an enormous success.–Dennis Ritchie.
In Spring 1993, in the Operating System development group at SunSoft, we had a “priority one” bug report come in describing a problem in the asynchronous I/O library. The bug was holding up the sale of $20 million worth of hardware to a customer who specifically needed the library functionality, so we were extremely motivated to find it.
When was C born

Software Dogma 1
The Golden Rule of Compiler-Writers:Performance Is (almost) Everything.
Performance is almost everything in a compiler. Compiler performance has two aspects: runtime performance (how fast the code runs) and compile time performance (how long it takes to generate code). Runtime performance usually dominates, except in development and student environments.
Many compiler optimizations cause longer compilation times but make run times much shorter. Other optimizations (such as dead code elimination, or omitting runtime checks) speed up both compile time and run time, as well as reducing memory use. The downside of aggressive optimization is the risk that invalid results may not be flagged. Optimizers are very careful only to do safe transformations, but programmers can trigger bad results by writing invalid code (e.g., referencing outside an array’s bounds because they “know” that the desired variable is adjacent).

3.How many Cs?
How many Cs
By the mid 1970’s the language was recognizably the C we know and love today.
In 1978 Steve Johnson wrote pcc, the portable C compiler. The source was made available outside Bell Labs, and it was very widely ported, forming a common basis for an entire generation of C compilers.
Anyone learning or using C should be working with ANSI C, not K&R C.
The ANSI C standard is unique in several interesting ways. It defines the some terms, describing characteristics of an implementation. A knowledge of these terms will aid in understanding what is and isn’t acceptable in the language.

4.关于ANSI C
ANSI C 主要标准化了现存的实践,同时增加了一些来自 C++ 的内容 (主要是函数原型) 并支持多国字符集 (包括备受争议的三字符序列)。 ANSI C 标准同时规定了 C 运行期库例程的标准。
ANSI C被几乎所有广泛使用的编译器支持。而且多数C代码是在ANSI C基础上写的。任何仅仅使用标准C并且没有任何硬件依赖假设的代码实际上能保证在任何平台上用遵循C标准的编译器编译成功。如果没有这种预防措施,多数程序只能在一种特定的平台或特定的编译器上编译,例如,使用非标准库,例如图形用户界面库,或者有关编译器或平台特定的特性例如数据类型的确切大小和字节序。
支持 ANSI C 的编译器编辑
1、GCC
2、Microsoft Visual C++ (C90. A few features of C99) (msvc doesn’t support C99 at all. for example )
3、ARM RealView

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值