grunwald@flute.cs.uiuc.edu (03/18/89)
``The subject sez it all.'' This is a plea to all C++ implementors out there. PLEASE GIVE A WARNING MESSAGE WHEN YOU SEE ``delete foo'' BUT YOU HAVEN'T SEEN THE CLASS BODY FOR ``foo''!!!!!! I just spent 3 days tracking down a bug related to this. A class ``Message'' had a destructor. However, in the one file where Messages were deleted, I didn't include (through oversight) the .h file. Class ``Messages'' has a private block-allocator, and uses a destructor to chain items on a freelist. Without seeing that class definition, the AT&T C++ 1.2 and G++ 1.34.1 compilers both assumed that a call to __builtin_delete or whatever was just fine. This trashes malloc() is a very un-debuggable way. -- Dirk Grunwald Univ. of Illinois grunwald@flute.cs.uiuc.edu
vd@litp.UUCP (Vincent D'LAC) (03/31/89)
Dans son article grunwald@flute.cs.uiuc.edu ecrit: . . PLEASE GIVE A WARNING MESSAGE WHEN YOU SEE ``delete foo'' BUT YOU . HAVEN'T SEEN THE CLASS BODY FOR ``foo''!!!!!! . . I just spent 3 days tracking down a bug related to this. A class . definition, the AT&T C++ 1.2 and G++ 1.34.1 compilers both assumed . that a call to __builtin_delete or whatever was just fine. . . Dirk Grunwald . Univ. of Illinois . grunwald@flute.cs.uiuc.edu Well, isn't that the more general big failure of C++ : doing lots of things in your back ? I suggest a little test : just try to enumerate (without the book) the erroneous figures (type errors for example) that you can legally write in this language when you have : a class (say C) with a constructor "C(int z)", a destructor, and a member operator "int()" in it... In all these situations, your program can run perfectly well, until it crashes (or not ). (flames off) I certainly would not program in C++ but i am curious about anything that concerns programming languages. Speaking about C++, I would like to know more about the current practice : 1- Do YOU, C++ programmers have some kind of self-discipline to avoid these kind of traps - any method ? how do you accomodate with such a weakly specified language ? 2- Are such methodologies developped in software companies ? (by the way does any soft.comp use this language for large projects ?). merci d'avance (thanks in advance) Vincent Delacour
fabbott@athena.mit.edu (Freeland K Abbott) (04/01/89)
In article <1796@litp.UUCP> vd@litp.UUCP (Vincent D'LAC) writes: >1- Do YOU, C++ programmers have some kind of self-discipline to avoid >these kind of traps - any method ? how do you accomodate with such a weakly >specified language ? > >2- Are such methodologies developped in software companies ? (by the way >does any soft.comp use this language for large projects ?). Yup. I work at Lotus Development Corp., and in my group at least C++ is the primary development languages. Some ordinary C code is used for really ugly sorts of things that would like to be classes but for whatever reason can't be... I guess you just learn to deal with the quirks of this language or any other. >merci d'avance >(thanks in advance) > > Vincent Delacour You're welcome in retrospect. Freeland K. Abbott fabbott@athena.mit.edu 454F 410 Memorial Drive MIT Undergrad (undeclared) Cambridge, MA 02139 USA "stop the world, I want to get off..."