ddd
[Top][All Lists]
Advanced

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

using new C++ casts


From: Arnaud Desitter
Subject: using new C++ casts
Date: Wed, 02 May 2001 12:23:53 +0100

Hi,

A small patch against ddd 3.3 and a new file below in order to be able 
to use new C++ casts in later development.

Cheers,
Arnaud


diff -r -u ddd-3.3/ddd/acinclude.m4 ddd-3.3-1/ddd/acinclude.m4
--- ddd-3.3/ddd/acinclude.m4    Fri Feb  2 14:57:35 2001
+++ ddd-3.3-1/ddd/acinclude.m4  Tue Feb 27 16:26:18 2001
@@ -754,6 +754,32 @@
 dnl
 dnl
 dnl
+dnl ICE_CXX_NEW_CASTS
+dnl ----------------
+dnl
+dnl If the C++ compiler accepts the c++ style casts, define
`HAVE_NEW_CASTS'.
+dnl
+AC_DEFUN(ICE_CXX_NEW_CASTS,
+[
+AC_REQUIRE([AC_PROG_CXX])
+AC_MSG_CHECKING(whether the C++ compiler (${CXX}) supports new style
casts)
+AC_CACHE_VAL(ice_cv_have_new_casts,
+[
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+AC_TRY_COMPILE(,[void f() { double *x = 0; char *s =
reinterpret_cast<char*>(x); }],
+ice_cv_have_new_casts=yes,
+ice_cv_have_new_casts=no)
+AC_LANG_RESTORE
+])
+AC_MSG_RESULT($ice_cv_have_new_casts)
+if test "$ice_cv_have_new_casts" = yes; then
+AC_DEFINE(HAVE_NEW_CASTS)
+fi
+])dnl
+dnl
+dnl
+dnl
 dnl ICE_CXX_NAMESPACE
 dnl -----------------
 dnl
Only in ddd-3.3-1/ddd: new_casts.h
diff -r -u ddd-3.3/ddd/oldcxx.h ddd-3.3-1/ddd/oldcxx.h
--- ddd-3.3/ddd/oldcxx.h        Thu Aug 19 12:28:45 1999
+++ ddd-3.3-1/ddd/oldcxx.h      Tue Feb 27 16:24:48 2001
@@ -42,5 +42,8 @@
 // Provide an `explicit' replacement
 #include "explicit.h"
 
+// Provide an interface to new style casts
+#include "new_casts.h"
+
 #endif // _DDD_oldcxx_h
 // DON'T ADD ANYTHING BEHIND THIS #endif



new_casts.h

// $Id: $ -*- C++ -*-
// Provide a new casts macros

// Copyright (C) 1998 Technische Universitaet Braunschweig, Germany.
// Written by Andreas Zeller <address@hidden>.
// 
// This file is part of DDD.
// 
// DDD is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
// 
// DDD is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public
// License along with DDD -- see the file COPYING.
// If not, write to the Free Software Foundation, Inc.,
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// 
// DDD is the data display debugger.
// For details, see the DDD World-Wide-Web page, 
// `http://www.gnu.org/software/ddd/',
// or send a mail to the DDD developers <address@hidden>.

#ifndef _DDD_new_casts_h
#define _DDD_new_casts_h

#ifdef __GNUG__
#pragma interface
#endif

#include "config.h"

#if !HAVE_NEW_CASTS
#  define CONST_CAST(TYPE,OBJ) ((TYPE)(OBJ))
#  define STATIC_CAST(TYPE,OBJ) ((TYPE)(OBJ))
#  define REINTERPRET_CAST(TYPE,OBJ) ((TYPE)(OBJ))
#else
#  define CONST_CAST(TYPE,OBJ) (const_cast<TYPE>(OBJ))
#  define STATIC_CAST(TYPE,OBJ) (static_cast<TYPE>(OBJ))
#  define REINTERPRET_CAST(TYPE,OBJ) (reinterpret_cast<TYPE>(OBJ))
#endif

#endif // _DDD_new_casts_h
// DON'T ADD ANYTHING BEHIND THIS #endif

_____________________________________________________________________
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



reply via email to

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