avr-libc-dev
[Top][All Lists]
Advanced

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

Re: [avr-libc-dev] adding wrapper functions for new and, delete operator


From: Bradley Jarvis
Subject: Re: [avr-libc-dev] adding wrapper functions for new and, delete operators
Date: Fri, 11 Feb 2011 16:49:25 +1100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20110114 Lightning/1.0b2 Thunderbird/3.1.7

> I've got only two concerns about that:
>
> . This your email will get lost in outer space soon; don't miss to
>   file a patch request as soon as the discussion here settled.  Please
>   don't forget to patch the documentation (I think, at least the FAQ
>   contains some remarks about the state of C++, so that should be
>   updated).
I will have a look at making a patch to add new and delete support
> . Where should those workarounds go to?  I'm not a C++ expert, but I
>   think as new and delete are operators in C++, no particular header
>   file is needed for them.  So, we could either add them to <stdlib.h>
>   (which declares malloc() and friends for the C language), wrapped in
>   #if defined __cplusplus brackets, or add a separate header file,
>   like <compat/c++.h>, or something like that.
>
I have had a look at gcc for the i686 and new and delete functions
appear to be located in the library libstdc++ . There is an additional
include directory called 'g++-v4' as well which contains the c++ header
files and where the file 'new' is located which contains the declaration
for new and delete (ie #include <new> is used to be able to use new and
delete).

I have noticed that the i686 gcc is compiled with the extra option

--with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.4.4/include/g++-v4

which adds the extra directory for c++ headers in the include search path.

So I can look at adding the extra library libstdc++ for the code and the
extra header file new. I can either look at adding the extra
directory(g++-v4 which is located in the include directory) for c++
header files or simply add it in with the other c header files. The c++
header files appear to be missing the .h. I would avoid using a header
the header compat/c++.h since that would require the programmer to use a
#ifdef to switch header files includes if the code is used on different
platforms. I include the new and delete operators from #include <string>
which includes <new>, so I will add the string header too



reply via email to

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