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 operators


From: John Myers
Subject: Re: [avr-libc-dev] adding wrapper functions for new and delete operators
Date: Tue, 15 Feb 2011 20:41:54 -0800

On Sun, Feb 13, 2011 at 2:25 AM, Bradley Jarvis <
address@hidden> wrote:

> On 02/13/11 04:01, address@hidden wrote:
> >  The new / delete operators can be put in a different namespace in order
> to
> > avoid any name collisions with the new/delete in the std namespace.
> > the header could still be called new and then just put it in the compat
> > directory (compat/new) to differentiate it from the standards compliant
> new
> > header.
> The header file is not needed as Joerg pointed out, I have tried to
> define the operators as inline in a header since they only wrap the
> malloc and free functions however this does not seem to work and I end
> up getting errors because of multiple instances. So I have had a look at
> adding the wrappers to the stdlib library in a new file called new.c
> that basically contains

 ...

> The only problem though is the the compiler baulks at the c++ stuff
> while building avr-libc. I tried encapsulating in extern "c++" {} but it
> did not seem to help. I will keep playing around with it, but am open to
> suggestions on what to try.
>

For simple programs the <new> header might not be needed but when files
don't use the std namespace they will need the <new> header.
I was actually only thinking of the header file being for declaring the
functions.
If you haven't already, you could try changing the extension of new.c to a
C++ extension (new.cc, new.cpp) to try and get stdlib to compile.

--John


reply via email to

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