Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!decwrl!bacchus.pa.dec.com!shlump.nac.dec.com!labc.enet.dec.com!wallis From: wallis@labc.enet.dec.com (Barry L. Wallis) Newsgroups: comp.lang.c++ Subject: Turbo-C++ problem when compiling without debugging info Message-ID: <14509@shlump.nac.dec.com> Date: 12 Aug 90 21:28:24 GMT Sender: newsdaemon@shlump.nac.dec.com Organization: Digital Equipment Corporation Lines: 83 The attached program exhibits some strange behavior. When compiled and linked with debugging information turned on (both in the IDE or on the command line) the prgram works fine. However, when the debugging information is turned off (-v- on the command line). Needless to say this makes debugging very difficult. The classes #included using qutoation marks are from the Turbo-C++ class library. The others are the normal Turbo-C++ header files. Any ideas? // SUBST.CPP Filter by substituting words // #include #include #include #include // Must appear after #include "assoc.h" #include "dict.h" #include "strng.h" const int word_size = 80; // Maximum size of an input word // Prototype void load_dictionary(Dictionary& dict, char* filespec); int main(int argc, char* argv[]) { if (argc <= 1) { cerr << "usage: subst wordlist_filespec output\n"; exit(EXIT_FAILURE); } Dictionary& dict = *(new Dictionary); load_dictionary(dict, argv[1]); cin.unsetf(ios::skipws); char in_word[word_size]; do { while (cin.good() && isspace(cin.peek())) cout << (char)cin.get(); if (!cin.good()) break; if (isalpha(cin.peek())) { for (int i = 0; cin.good() && i < word_size - 1 && isalnum(cin.peek()); i++) in_word[i] = cin.get(); in_word[i] = '\0'; String out_word = in_word; Association& assoc = dict.lookup(out_word); if (assoc != NOOBJECT) { cout << assoc.value(); } else { cout << out_word; } } else { cin >> setw(word_size) >> in_word; cout << in_word; } } while (cin.good()); } void load_dictionary(Dictionary& dict, char* filespec) { ifstream input(filespec); char word[word_size]; while (input.good()) { input >> setw(word_size) >> word; String& word1 = *(new String(word)); input >> setw(word_size) >> word; String& word2 = *(new String(word)); Association& assoc = *(new Association(word1, word2)); dict.add(assoc); } } I read comp.lang.c++ regularly, but, e-mail shouldn't bounce either. Thanks for any help you can give (especially a dumb mistake). --- Barry L. Wallis USENET: wallis@labc.dec.com Database Consultant Prodigy (don't laugh): DNMX41A U.S. DECtp Resource Center DECUServe: EISNER::WALLIS (not on the net yet) Los Angeles, CA "No one voted for me, I represent myself" ---