c语言中@的意思是什么? 10
程序中有这样一句:volatileab@c其中a,b和c都是宏定义的变量不知是什么意思?求高人指点!实在不好意思说错了,c是宏定义的变量,a是一个结构体...
程序中有这样一句:
volatile a b@c
其中a,b和c都是宏定义的变量
不知是什么意思?求高人指点!
实在不好意思说错了,c是宏定义的变量,a是一个结构体 展开
volatile a b@c
其中a,b和c都是宏定义的变量
不知是什么意思?求高人指点!
实在不好意思说错了,c是宏定义的变量,a是一个结构体 展开
7个回答
展开全部
@可以这样用
Declaration = <TypeSpec> <Declarator>[@<Address>|@"<Section>"]
[= <Initializer>];
Global Variable Address Modifier (@address)
You can assign global variables to specific addresses with the global variable address modifier. These variables are called 'absolute variables'. They are useful for accessing memory mapped I/O ports and have the following syntax:
Declaration = <TypeSpec> <Declarator>[@<Address>|@"<Section>"]
[= <Initializer>];
<TypeSpec> is the type specifier, e.g., int, char
<Declarator> is the identifier of the global object, e.g., i, glob
<Address> is the absolute address of the object, e.g., 0xff04, 0x00+8
<Initializer> is the value to which the global variable is initialized.
A segment is created for each global object specified with an absolute address. This address must not be inside any address range in the SECTIONS entries of the link parameter file. Otherwise, there would be a linker error (overlapping segments). If the specified address has a size greater than that used for addressing the default data page, pointers pointing to this global variable must be "__far". An alternate way to assign global variables to specific addresses is (Listing 8.8).
Listing 8.8 Assigning global variables to specific addresses
#pragma DATA_SEG [__SHORT_SEG] <segment_name>
setting the PLACEMENT section in the linker parameter file. An older method of accomplishing this is shown in Listing 8.9.
Listing 8.9 Another means of assigning global variables to specific addresses
<segment_name> INTO READ_ONLY <Address> ;
Listing 8.10 is a correct and incorrect example of using the global variable address modifier and Listing 8.11 is a possible PRM file that corresponds with example Listing.
Listing 8.10 Using the global variable address modifier
//看这意思,就是把int型变量glob地址从0x0500开始,并把值10初始化时放在0x0500
int glob @0x0500 = 10; // OK, global variable "glob" is
// at 0x0500, initialized with 10
void g() @0x40c0; // error (the object is a function)
void f() {
int i @0x40cc; // error (the object is a local variable)
}
Declaration = <TypeSpec> <Declarator>[@<Address>|@"<Section>"]
[= <Initializer>];
Global Variable Address Modifier (@address)
You can assign global variables to specific addresses with the global variable address modifier. These variables are called 'absolute variables'. They are useful for accessing memory mapped I/O ports and have the following syntax:
Declaration = <TypeSpec> <Declarator>[@<Address>|@"<Section>"]
[= <Initializer>];
<TypeSpec> is the type specifier, e.g., int, char
<Declarator> is the identifier of the global object, e.g., i, glob
<Address> is the absolute address of the object, e.g., 0xff04, 0x00+8
<Initializer> is the value to which the global variable is initialized.
A segment is created for each global object specified with an absolute address. This address must not be inside any address range in the SECTIONS entries of the link parameter file. Otherwise, there would be a linker error (overlapping segments). If the specified address has a size greater than that used for addressing the default data page, pointers pointing to this global variable must be "__far". An alternate way to assign global variables to specific addresses is (Listing 8.8).
Listing 8.8 Assigning global variables to specific addresses
#pragma DATA_SEG [__SHORT_SEG] <segment_name>
setting the PLACEMENT section in the linker parameter file. An older method of accomplishing this is shown in Listing 8.9.
Listing 8.9 Another means of assigning global variables to specific addresses
<segment_name> INTO READ_ONLY <Address> ;
Listing 8.10 is a correct and incorrect example of using the global variable address modifier and Listing 8.11 is a possible PRM file that corresponds with example Listing.
Listing 8.10 Using the global variable address modifier
//看这意思,就是把int型变量glob地址从0x0500开始,并把值10初始化时放在0x0500
int glob @0x0500 = 10; // OK, global variable "glob" is
// at 0x0500, initialized with 10
void g() @0x40c0; // error (the object is a function)
void f() {
int i @0x40cc; // error (the object is a local variable)
}
展开全部
@ 只能放在字符,字符串或注解行里使用。
例如: char s[]="b@c"; // @ in string
它不是运算符,也不能作为标识符的一部分。
volatile 变量 是 易变化变量,编译器不得对它作优化处理。
例如: char s[]="b@c"; // @ in string
它不是运算符,也不能作为标识符的一部分。
volatile 变量 是 易变化变量,编译器不得对它作优化处理。
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
#define AP_CODE_ADDR_START 0
#define AP_CODE_LEN 0x14000
const uint16_t FixData@(AP_CODE_ADDR_START + AP_CODE_LEN-2) = 0x55aa;
/************以下解释***************/
定义uint16_t类型的FixData变量,并且指定其初始地址,并且变量赋值为0x55aa。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
表示不显示@后面的命令
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询