n**d 发帖数: 9764 | 1 Found this from a opensurce code, but it can not pass my compiler. How does
it work?
typedef struct rrc_List {
struct rrc_List *next;
int value;
} *rrc_List; |
k****e 发帖数: 100 | 2 贴出你的compiler版本
另外,把最后一个 rrc_List 换个名字看看。
does
【在 n**d 的大作中提到】 : Found this from a opensurce code, but it can not pass my compiler. How does : it work? : typedef struct rrc_List { : struct rrc_List *next; : int value; : } *rrc_List;
|
n**d 发帖数: 9764 | 3 g++ 3.4.4.
把最后一个 rrc_List 换个名字, of course it works. However, We are not suppose to modify the 3rd party code.
【在 k****e 的大作中提到】 : 贴出你的compiler版本 : 另外,把最后一个 rrc_List 换个名字看看。 : : does
|
k**f 发帖数: 372 | 4
Then why use opensource code, which is meant to be modified if it doesn't
work for you?
【在 n**d 的大作中提到】 : Found this from a opensurce code, but it can not pass my compiler. How does : it work? : typedef struct rrc_List { : struct rrc_List *next; : int value; : } *rrc_List;
|
n**d 发帖数: 9764 | 5 I don't think you know how companies use the opensouce resource. Anyway,
that has nothing to do with this topic.
Let us concentrate on the code. Is it wrong?
【在 k**f 的大作中提到】 : : Then why use opensource code, which is meant to be modified if it doesn't : work for you?
|
K****n 发帖数: 5970 | 6 typedef 把一个struct变成 struct*, 没见过这种用法.
一般都是
typedef struct myStruct{
...;
} myStruct;吧
【在 n**d 的大作中提到】 : I don't think you know how companies use the opensouce resource. Anyway, : that has nothing to do with this topic. : Let us concentrate on the code. Is it wrong?
|
n****g 发帖数: 150 | 7 probably the previous standard treats "struct xxx" and "xxx" as different
declarations, so it worked at that time.
not sure. |
r********d 发帖数: 23 | 8 This definitely works with a C compiler; but it's an error with a C++
compiler
does
【在 n**d 的大作中提到】 : Found this from a opensurce code, but it can not pass my compiler. How does : it work? : typedef struct rrc_List { : struct rrc_List *next; : int value; : } *rrc_List;
|
n**d 发帖数: 9764 | 9 You are right. It passes C compiler. Then it comes how to understand the
code.
The rrc_List should be used to define a pointer which points to the
structure, right?
【在 r********d 的大作中提到】 : This definitely works with a C compiler; but it's an error with a C++ : compiler : : does
|
K****n 发帖数: 5970 | 10 对
冲突的原因估计是:
rrc_List 本来是struct名,现在变成了rrc_List*
我试了下(先不typedef成指针),c++里声明struct可以用
rrc_List rrc_list;//绕过 struct rrc_List rrc_list;
现在typedef以后声明
rrc_List不知道是在说指针还是说他自己.
【在 n**d 的大作中提到】 : You are right. It passes C compiler. Then it comes how to understand the : code. : The rrc_List should be used to define a pointer which points to the : structure, right?
|
|
|
K****n 发帖数: 5970 | 11 所以如你所知,换个名字就work了
【在 K****n 的大作中提到】 : 对 : 冲突的原因估计是: : rrc_List 本来是struct名,现在变成了rrc_List* : 我试了下(先不typedef成指针),c++里声明struct可以用 : rrc_List rrc_list;//绕过 struct rrc_List rrc_list; : 现在typedef以后声明 : rrc_List不知道是在说指针还是说他自己.
|
T*****9 发帖数: 2484 | 12 typedef struct A{} *A?
does
【在 n**d 的大作中提到】 : Found this from a opensurce code, but it can not pass my compiler. How does : it work? : typedef struct rrc_List { : struct rrc_List *next; : int value; : } *rrc_List;
|
r*******y 发帖数: 290 | 13 Avoid using open source code
free means nobody is responsible for it
it's a pain in the ass if your code gets bigger and bigger
and there is a memory leak in the 3rd party code...you dont want that
suppose to modify the 3rd party code.
【在 n**d 的大作中提到】 : g++ 3.4.4. : 把最后一个 rrc_List 换个名字, of course it works. However, We are not suppose to modify the 3rd party code.
|
r********d 发帖数: 23 | 14 laf...
【在 r*******y 的大作中提到】 : Avoid using open source code : free means nobody is responsible for it : it's a pain in the ass if your code gets bigger and bigger : and there is a memory leak in the 3rd party code...you dont want that : : suppose to modify the 3rd party code.
|
f******y 发帖数: 2971 | 15 funny
【在 r*******y 的大作中提到】 : Avoid using open source code : free means nobody is responsible for it : it's a pain in the ass if your code gets bigger and bigger : and there is a memory leak in the 3rd party code...you dont want that : : suppose to modify the 3rd party code.
|
d******n 发帖数: 42 | |
d******n 发帖数: 42 | 17 Using open source code is ok, just avoid using the code that is not
maintained. |