The Basic Data Types1

本文详细介绍了C语言中的基础数据类型,包括整型、字符型、浮点型及复数类型等,并提供了如何声明变量的具体指导。

基础的数据类型设置为如下11个关键词:int, long , short, unsigned, char ,float, double, signed,_Bool,_Complex,和_Imaginary

有符号的整型:

这些数有分正数和负数:

int--是已有系统的基础整型,C语言保证至少有16位的存储用于int型

short 或者是 short int --最大的短整型不会大于int型,它更小,C语言也保证最少16位存储用于short型。

long  或者是long int 至少保持像int型那么大,C语言最找也有32位用于long型

long long 或者是long long int--这个类型保留一个整数,最少像long型,long long 型至少有64位。

典型的是,long型将会大于short型,而且int型将会和这两者之间的一个相同,例如,PC下的DOS系统,提供了16位的short 型和int 型还有32位的long型,Windows 95为基础的操作系统,提供了16位的short型,还有32位的int和long型。

如果你喜欢你可以使用关键词signed,将它用于任何有符号的类型,使得他们符号明确。

无符号的整型:

这些数据只有0和其他正数,这些数据的最大范围是正数,使用关键词unsigned 在这些的定义类型之前:unsigned int, unsigned long,unsigned short,一个单独unsigned默认是unsigned int

字符型:

这些是印刷字符,例如A,&,和+,通过定义,char型占用了内存的一个字节,代表一个字符,历史上看,字符型的字节大多是8位,如果需要表示基础的字符集,不过特也有16位或者更大。

char--是字符型的关键词,一些实现用有符号的char来实现,也有是用无符号的char型,C语言允许你使用关键词signed和unsigned来确定你想要的形式。

布尔型:

布尔型的值代表true和false;C语言使用1代表true,用0代表false

_Bool--是这个类型的关键词,这是一个无符号int型,且仅需要足够大来容纳0-1的数。

浮点型:

这些数有正数还有负数

float--系统基础的浮点数类型,它可以代表至少6个重要精确的小数。

double--可能比浮点型数更大的单元,它允许有更多的精确小数(至少典型的10或者更多),很可能比float更多。

long double--一个更大的单元来存储浮点型,它可以允许更多的精确小数,比double更多。

复数点:

复数类型是可选的,实数的复数部分有如下实部:

float        _Complex

double    _Complex

long double _Complex

float        _Imaginary

double    _Imaginary

long double _Imaginary


总结:如何声明一个简单变量

1. Choose the type you need.
2. Choose a name for the variable using the allowed characters.
3. Use the following format for a declaration statement:
    type-specifier variable-name;
   The type-specifier is formed from one or more of the type keywords; here are examples of declarations: 

int erest;

unsigned short cash;.

4. You can declare more than one variable of the same type by separating the variable names with commas. Here's an example:
 char ch, init, ans;.
5. You can initialize a variable in a declaration statement:

float mass = 6.0E24;

<think> Hmm, the user has asked for a Chinese translation of a technical Java comment related to abstract types in basic blocks, with a specific focus on bytecode manipulation concepts. This seems to be part of a series where they're systematically translating ASM library documentation. Looking at the context, this is clearly for advanced Java bytecode engineering - probably someone working on compilers or low-level frameworks. The comment discusses tricky concepts like UNINITIALIZED types and frame computation algorithms. The user must be deep in bytecode manipulation territory. The translation needs extreme precision with terms like "abstract types" and "operand stack" - these are formal JVM specification terms. I notice the original text has complex nested clauses about constructor invocation replacement rules. Will need to: First unpack the technical meaning: it's explaining why constructor calls require special handling during abstract interpretation. Then find Chinese equivalents that preserve both the technical accuracy and the nuance about two-step frame computation. Special attention needed for: "abstract types that are relative to" - this refers to type propagation dependencies in data flow analysis. "FORWARD_UNINITIALIZED" is a special ASM state for forward references. The italics on "every occurrence" emphasizes absolute replacement necessity. Previous translations show user appreciates added translator notes, so I'll include those again. Also must remember the strict formatting rules for the mandatory questions section - they've reminded me three times now about the §§格式§§ requirement. The questions should probe deeper into: 1) The practical implications of UNINITIALIZED_THIS handling 2) Performance tradeoffs in the two-step algorithm 3) How this relates to real-world stack map frame verification failures </think> ```java /** * 基本块中初始化的抽象类型。对 UNINITIALIZED(未初始化)、FORWARD_UNINITIALIZED(前向未初始化)或 UNINITIALIZED_THIS(当前未初始化)抽象类型 * 的构造函数调用,必须替换局部变量和操作数栈中<i>所有出现的</i>该类型。此操作无法在算法第一步执行,因为在此阶段局部变量和操作数栈 * 类型仍为抽象状态。因此需要存储基本块中调用的构造函数的抽象类型,以便在算法第二步(完全计算帧时)执行此替换。注意:此数组可包含 * 相对于输入局部变量或输入栈的抽象类型。 */ ``` ### 翻译要点说明 - **术语一致性** - 保留 `UNINITIALIZED` 等常量名不翻译,括号内补充中文注释 - "abstract types" 统一译为 "抽象类型","operand stack" 译为 "操作数栈" - **技术逻辑还原** - "replace every occurrence" 强调为 "替换所有出现的" - 明确区分 "first step"(第一步)和 "second step"(第二步)的时序关系 - **复杂概念处理** - "relative to" 译为 "相对于" 保持数学语境 - "frames are fully computed" 意译为 "完全计算帧时" 避免直译生硬
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值