ddd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch against 3.3.1 related to const and other fixes.


From: Arnaud Desitter
Subject: Patch against 3.3.1 related to const and other fixes.
Date: Fri, 08 Jun 2001 17:01:35 +0100

Hi Andreas,

First all, let express my admiration related to the quality 
of your coding, especially considering the size of ddd.

I finally finished some modifications to ddd I had in the back 
of my  mind for quite a while now. You will find below a summary 
of  changes and, of course, the patch attached.

I hope everything is going fine in your new position.

Regards,
Arnaud

Summary of changes:

#1 Leak fixes.
This patch includes previously posted patches related to memory 
leaks.
#2 conversion operators removed in strclass.h and MString.h
I suppressed these operators and added explicit calls to chars() 
  and xmstring() where needed. Loads of reasons to do so:
 o preserving const correctness
 o string is an object and has a life cycle different from a
   raw "char*". Clear separation makes it possible to find bugs
   (see below #3.1).
 o makes it closer to std:string and std:stringstream. One day,
   ddd could optionally use the standard C++ library.
#3 Bugs correction
#3.1 several bugs related string/char* conversion fixed.
     Typically, it involved a call to a function returning
     a "string" passed as a "char*" dummy arguments. The
     string gets deallocated and the char* points to invalid
     memory. All such bugs are fixed (look for "().chars()"). 
#3.2 potential read on read-only memory
     It was in PlotArea.C. Needs some reviewing to make sure.
#4 const correctness
   I added some const here and there. Additionally, some 
   "char[]" has been changed to const char*. And of course, 
   the unsafe conversion operators are gone.
   Compiling ddd with "g++ -Wcast-qual" is nearly bearable ;-)
#4 ddd uses new C++ casts
   Most if not all "(char*)X" changed to CONST_CHAR(char*,X) or
   STATIC_CAST(char*,X).

Testing:
#1 ddd with the patch applied compiles properly on:
   gcc 2.9x on linux x86 and Itanium, HP aCC on HP-UX, Compaq cxx on 
   OSF/alpha, Sun CC 4.2 and 5.2 on Solaris, IBM xlC 5.0 on AIX, SGI CC 
   on IRIX.
#2 The semantic is virtually unchanged. Therefore, except potentially in 
   PlotArea.C, I don't expect any introduction of new bugs.

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
01285 884400.

Attachment: ddd-3.3.1-cast.txt
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]