3 回答
TA贡献1828条经验 获得超3个赞
typedef struct X { int x; } X;
struct S { int x; };typedef struct S S;
S
struct S
:
void f( struct S argument ); // struct is required here
S
void f( S argument ); // struct keyword no longer needed
S
typedef struct S { int x; } T;void S() { } // correct//void T() {} // error: symbol T already defined as an alias to 'struct S'
typedef
// C++struct S { int x; }; // S defined as a classvoid f( S a ); // correct: struct is optional
S
S
typedef struct S { int x; } T;void S() {} // correct [*]//void T() {} // error: symbol T already defined as an alias to 'struct S'
S
struct
// previous code here...int main() { S(); struct S s;}
TA贡献1839条经验 获得超15个赞
struct
typedef
struct
struct foo { int n;};
struct foo
foo
struct
namespace
A typedef
typedef int my_int;
my_int
int
; my_int
int
struct
typedef struct foo foo;
struct foo
typedef
foo
.
struct
typedef
typedef struct bar { int n;} bar;
struct bar
bar
.
struct
typedef struct node { int data; struct node *next; /* can't use just "node *next" here */} node;
typedef struct node_s { /* ... */} node;
typedef
struct bar
typedef
n
struct blah
blah
- 3 回答
- 0 关注
- 566 浏览
添加回答
举报