This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos 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: New memory allocation debug feature


Andrew Lunn <andrew@lunn.ch> writes:

> On Thu, Jun 17, 2004 at 12:55:11PM +0200, ?yvind Harboe wrote:
> > Comments?
> 
> I would prefer the function to use the cyg_ prefix so it does not
> polute the namespace.

To underline this, the naming convention for eCos is to separate words
in a name with underscores, not to use capitalization. Names should
also contain the subsystem that they belong to and be descriptive of
what they do. I think that the function should probably also have some
arguments indicating, at least, the size of allocation that failed and
the memory pool that has been exhausted.

So I would like to see something more like:

__externC void cyg_memalloc_alloc_fail( CYG_ADDRESS pool, cyg_uint32 size );

In theory this whole thing should be better integrated into the C++
classes that implement the memory allocators, but having an external
function to call is an acceptable first step.

> 
> You also need to provide an implementation in libtarget.a for when the
> application does not have such a function. eg all the test programs
> will not provide this function, so will fail to link when your new
> option is enabled. So please add a week function which does nothing,
> or maybe throws an CYG_FAIL().

s/week/weak/ :-)


-- 
Nick Garnett                    eCos Kernel Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


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