Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!viusys!uxui!unislc!scl From: scl@unislc.uucp (Sean Landis) Newsgroups: comp.lang.c Subject: Yet Another Argument for Nested Comments Message-ID: <1991Jan28.205309.2836@unislc.uucp> Date: 28 Jan 91 20:53:09 GMT Organization: unisys Lines: 291 These arguments always seem more compelling when they reveal our own errors! I had a header file, hash.h, that looked like: #ifndef HASH_H #define HASH_H ... The code ... #endif /* HASH_H Then, I had hash.C: /******************************************************************** * My comment header. * ********************************************************************/ ... The code ... And, finally, main.C: main() { ... the code ... } ... some more functions ... Well, I was seeing truely bizarre error messages at compile time. Unfortunately, I was able to make them go away. Since I am just getting into C++, I allowed myself to believe that I was doing something wrong. I finally got all the modules to compile, but I started getting crazy messages from the linker stating that main() was an undefined symbol. Now you see it, now you don't. Well, after using every tool I had to figure it out, I confirmed that main was not in main.o. It was getting late, and I was desperate, so I moved main() to the end of main.C. I got a different link error - main() was fine! Well, I was very gladdened because now I had some evidence. Unfortunately, war broke out and I decided to go home, leaving the problem to the next day. Working, afresh, I spotted the error quickly. Here's hash.h again: #ifndef HASH_H #define HASH_H ... The code ... #endif /* HASH_H Looks like I forgot to terminate this comment. When this was included in hash.C, the comment header quietly terminated this comment without harm. Unfortunately, (fortunately?), main.C was test code, and had no header. So, I was left to baffle over the bizarre. Now, if C and C++ supported nested comments, the compiler would have been obliged to report that there was an unterminated comment. I would have saved about four hours of work! Oh well. It *NOW* seems to me that some traditions are worth parting from :-) Newsgroups: comp.lang.c Subject: Yet Another Argument for Nested Comments Distribution: local These arguments always seem more compelling when they reveal our own errors! I had a header file, hash.h, that looked like: #ifndef HASH_H #define HASH_H ... The code ... #endif /* HASH_H Then, I had hash.C: /******************************************************************** * My comment header. * ********************************************************************/ ... The code ... And, finally, main.C: main() { ... the code ... } ... some more functions ... Well, I was seeing truely bizarre error messages at compile time. Unfortunately, I was able to make them go away. Since I am just getting into C++, I allowed myself to believe that I was doing something wrong. I finally got all the modules to compile, but I started getting crazy messages from the linker stating that main() was an undefined symbol. Now you see it, now you don't. Well, after using every tool I had to figure it out, I confirmed that main was not in main.o. It was getting late, and I was desperate, so I moved main() to the end of main.C. I got a different link error - main() was fine! Well, I was very gladdened because now I had some evidence. Unfortunately, war broke out and I decided to go home, leaving the problem to the next day. Working, afresh, I spotted the error quickly. Here's hash.h again: #ifndef HASH_H #define HASH_H ... The code ... #endif /* HASH_H Looks like I forgot to terminate this comment. When this was included in hash.C, the comment header quietly terminated this comment without harm. Unfortunately, (fortunately?), main.C was test code, and had no header. So, I was left to baffle over the bizarre. Now, if C and C++ supported nested comments, the compiler would have been obliged to report that there was an unterminated comment. I would have saved about four hours of work! Oh well. It *NOW* seems to me that some traditions are worth parting from :-) Sean Newsgroups: comp.lang.c Subject: Yet Another Argument for Nested Comments Distribution: local These arguments always seem more compelling when they reveal our own errors! I had a header file, hash.h, that looked like: #ifndef HASH_H #define HASH_H ... The code ... #endif /* HASH_H Then, I had hash.C: /******************************************************************** * My comment header. * ********************************************************************/ ... The code ... And, finally, main.C: main() { ... the code ... } ... some more functions ... Well, I was seeing truely bizarre error messages at compile time. Unfortunately, I was able to make them go away. Since I am just getting into C++, I allowed myself to believe that I was doing something wrong. I finally got all the modules to compile, but I started getting crazy messages from the linker stating that main() was an undefined symbol. Now you see it, now you don't. Well, after using every tool I had to figure it out, I confirmed that main was not in main.o. It was getting late, and I was desperate, so I moved main() to the end of main.C. I got a different link error - main() was fine! Well, I was very gladdened because now I had some evidence. Unfortunately, war broke out and I decided to go home, leaving the problem to the next day. Working, afresh, I spotted the error quickly. Here's hash.h again: #ifndef HASH_H #define HASH_H ... The code ... #endif /* HASH_H Looks like I forgot to terminate this comment. When this was included in hash.C, the comment header quietly terminated this comment without harm. Unfortunately, (fortunately?), main.C was test code, and had no header. So, I was left to baffle over the bizarre. Now, if C and C++ supported nested comments, the compiler would have been obliged to report that there was an unterminated comment. I would have saved about four hours of work! Oh well. It *NOW* seems to me that some traditions are worth parting from :-) Newsgroups: comp.lang.c Subject: Yet Another Argument for Nested Comments Distribution: local These arguments always seem more compelling when they reveal our own errors! I had a header file, hash.h, that looked like: #ifndef HASH_H #define HASH_H ... The code ... #endif /* HASH_H Then, I had hash.C: /******************************************************************** * My comment header. * ********************************************************************/ ... The code ... And, finally, main.C: main() { ... the code ... } ... some more functions ... Well, I was seeing truely bizarre error messages at compile time. Unfortunately, I was able to make them go away. Since I am just getting into C++, I allowed myself to believe that I was doing something wrong. I finally got all the modules to compile, but I started getting crazy messages from the linker stating that main() was an undefined symbol. Now you see it, now you don't. Well, after using every tool I had to figure it out, I confirmed that main was not in main.o. It was getting late, and I was desperate, so I moved main() to the end of main.C. I got a different link error - main() was fine! Well, I was very gladdened because now I had some evidence. Unfortunately, war broke out and I decided to go home, leaving the problem to the next day. Working, afresh, I spotted the error quickly. Here's hash.h again: #ifndef HASH_H #define HASH_H ... The code ... #endif /* HASH_H Looks like I forgot to terminate this comment. When this was included in hash.C, the comment header quietly terminated this comment without harm. Unfortunately, (fortunately?), main.C was test code, and had no header. So, I was left to baffle over the bizarre. Now, if C and C++ supported nested comments, the compiler would have been obliged to report that there was an unterminated comment. I would have saved about four hours of work! Oh well. It *NOW* seems to me that some traditions are worth parting from :-) Sean Newsgroups: local.news Subject: BASEBALL CARDS Distribution: local I am interested in buying, selling, or trading baseball cards with anyone. Sean Landis x 3988 1-649-9810