This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: V3 support for arm-none-symbianelf


Gabriel Dos Reis wrote:

Mark Mitchell <mark@codesourcery.com> writes:

| Gabriel Dos Reis wrote:
| | >Mark Mitchell <mark@codesourcery.com> writes:
| >
| >| ! #if _GLIBCXX_HOSTED
| >| ! using std::free;
| >| ! #else
| >| ! // In a freestanding environment, "free" may not be available. In
| >| ! // that case, it may make sense not to define "operator delete" at
| >| ! // all. For now, we assume that "free" will work.
| >
| >I do not understand this comment. operator delete is required,
| >freestanding or not. So, I do not understand the bits saying it may
| >make sense not to define "operator delete". Could you clarify?
| >
| Independent of what the standard says, some systems don't have dynamic
| memory management, and don't want it. If you don't have "free" on your
| system, you probably do not want "delete" either, depsite the fact
| that C++ requires "delete" and C does not require "free".


Thanks for clarifying your comments. I believe this elaboration much
clearer and less confusing, especially when the patch is viewed as
"vigorous support" for freestanding implementation. I believe it
should go in one form or the other in the source.


I checked in this simplification of the comments.

--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com

2004-08-03  Mark Mitchell  <mark@codesourcery.com>

	* libsupc++/new_op.cc: Update comments.
	* libsupc++/del_op.cc: Likewise.

Index: del_op.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/libsupc++/del_op.cc,v
retrieving revision 1.5
diff -c -5 -p -r1.5 del_op.cc
*** del_op.cc	2 Aug 2004 20:28:21 -0000	1.5
--- del_op.cc	3 Aug 2004 07:10:14 -0000
***************
*** 32,44 ****
  #include <cstdlib>
  
  #if _GLIBCXX_HOSTED
  using std::free;
  #else
! // In a freestanding environment, "free" may not be available.  In
! // that case, it may make sense not to define "operator delete" at
! // all.  For now, we assume that "free" will work.
  extern "C" void free(void *);
  #endif
  
  void
  operator delete (void *ptr) throw ()
--- 32,43 ----
  #include <cstdlib>
  
  #if _GLIBCXX_HOSTED
  using std::free;
  #else
! // A freestanding C runtime may not provide "free" -- but there is no
! // other reasonable way to implement "operator delete".
  extern "C" void free(void *);
  #endif
  
  void
  operator delete (void *ptr) throw ()
Index: new_op.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/libsupc++/new_op.cc,v
retrieving revision 1.7
diff -c -5 -p -r1.7 new_op.cc
*** new_op.cc	2 Aug 2004 20:28:21 -0000	1.7
--- new_op.cc	3 Aug 2004 07:10:14 -0000
***************
*** 34,46 ****
  using std::new_handler;
  using std::bad_alloc;
  #if _GLIBCXX_HOSTED
  using std::malloc;
  #else
! // In a freestanding environment, "malloc" may not be available.  In
! // that case, it may make sense not to define "operator new" at all.
! // For now, we assume that "malloc" will work.
  extern "C" void *malloc (std::size_t);
  #endif
  
  extern new_handler __new_handler;
  
--- 34,45 ----
  using std::new_handler;
  using std::bad_alloc;
  #if _GLIBCXX_HOSTED
  using std::malloc;
  #else
! // A freestanding C runtime may not provide "malloc" -- but there is no
! // other reasonable way to implement "operator new".
  extern "C" void *malloc (std::size_t);
  #endif
  
  extern new_handler __new_handler;
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]