Relevancy of C structures [modified]
-
I will really, really appreciate comments about a discussion in another web site. The reason I am asking here is because I feel unable to get an objective answer in the other site. See the CodeGuru Forums - struct vs class? thread. I posted a message saying that the question did not ask about C structures. I will appreciate knowing if my comment is valid. -- modified at 23:48 Saturday 20th May, 2006
-
I will really, really appreciate comments about a discussion in another web site. The reason I am asking here is because I feel unable to get an objective answer in the other site. See the CodeGuru Forums - struct vs class? thread. I posted a message saying that the question did not ask about C structures. I will appreciate knowing if my comment is valid. -- modified at 23:48 Saturday 20th May, 2006
Sam Hobbs wrote:
The reason I am asking here is because I feel unable to get an objective answer in the other site.
I read through the posts but I'm not sure what your question was. You stated a "matter of factly" thing. Case closed. The other participants seem preoccupied with quoting their textbooks. The question was too vague to begin with and warrants the issuer open a few books him/her self.
-
I will really, really appreciate comments about a discussion in another web site. The reason I am asking here is because I feel unable to get an objective answer in the other site. See the CodeGuru Forums - struct vs class? thread. I posted a message saying that the question did not ask about C structures. I will appreciate knowing if my comment is valid. -- modified at 23:48 Saturday 20th May, 2006
because the original-poster asked a question comparing struct+class, I would also limit my response to issues regarding C++ only - so you were right to state this. The other posters were just trying to be helpful I think, unfortunately they were fairly inaccurate in their description of the C vs C++ issues regarding structs, especially 'andreas' who stated: "As you can see they are different. That's because in C you are NOT defining a new data type with the definition of a structure. Therefore you need to add the keyword 'struct' in front of the name of the structure when you declare variables of it....In C++, however, a new type is defined when a structure is defined, and you can use this new type to declare variables, and the struct keyword is NOT needed." this is incorrect, in both C and C++ you are defining a new type "struct name", and it must always be referred to as this. However C++ contains a bodge, and whenever you define a struct in this language it also installs an alias to that struct-type sharing the same name: In C++ when you do this: struct mystruct { }; It is really doing this (from a C point of view) struct mystruct { }; typedef struct mystruct mystruct;
http://www.catch22.net -
because the original-poster asked a question comparing struct+class, I would also limit my response to issues regarding C++ only - so you were right to state this. The other posters were just trying to be helpful I think, unfortunately they were fairly inaccurate in their description of the C vs C++ issues regarding structs, especially 'andreas' who stated: "As you can see they are different. That's because in C you are NOT defining a new data type with the definition of a structure. Therefore you need to add the keyword 'struct' in front of the name of the structure when you declare variables of it....In C++, however, a new type is defined when a structure is defined, and you can use this new type to declare variables, and the struct keyword is NOT needed." this is incorrect, in both C and C++ you are defining a new type "struct name", and it must always be referred to as this. However C++ contains a bodge, and whenever you define a struct in this language it also installs an alias to that struct-type sharing the same name: In C++ when you do this: struct mystruct { }; It is really doing this (from a C point of view) struct mystruct { }; typedef struct mystruct mystruct;
http://www.catch22.netThank you very much. This really helps. Note that Andreas is a moderator but I have had problems with him. He really lacks social skills. It seems (to me) that anything he says will be defended (in that forum) and anything I say that conflicts with him will be criticized. Behavior such as that is unproductive. So to the extent that that thread is innacurate, it is important that people say so. I don't want to make it any more personal than what I have said here.
-
Sam Hobbs wrote:
The reason I am asking here is because I feel unable to get an objective answer in the other site.
I read through the posts but I'm not sure what your question was. You stated a "matter of factly" thing. Case closed. The other participants seem preoccupied with quoting their textbooks. The question was too vague to begin with and warrants the issuer open a few books him/her self.
-
Thank you. Yes, I was vague intentionally. I wanted to be fair and not influence people's reaction.
I meant the original question that was posted by the thread initiator was vague (Sorry about any confusion). Your comment seemed appropriate based on where the thread was heading vs. what was asked. Concerning your thread here, I wasn't sure what "objective answer" you were searching for but for what it was worth, you seemed to be stating facts and staying well within the boundaries of correctness.
-
I meant the original question that was posted by the thread initiator was vague (Sorry about any confusion). Your comment seemed appropriate based on where the thread was heading vs. what was asked. Concerning your thread here, I wasn't sure what "objective answer" you were searching for but for what it was worth, you seemed to be stating facts and staying well within the boundaries of correctness.
Thank you. I sure feel good about getting support and such. I certainly felt that I was being reasonable. I must insist however that my original question here is vague and I intended it to be. So what I can do is if I were try to explain to anyone that there is a problem with the attitude of people in the CodeGuru forums and if someone were to try to defend the moderator person there then I can say that people in a more independent forum have expressed a different opinion. I hope it is reasonable for me to do that. It is my intent to do that in a mature, reasonable and productive manner. -- modified at 23:06 Sunday 21st May, 2006