A "stateless"
malloc()
wrapper. In
(a)
,
malloc()
returns a pointer (mptr) to a block, the size of which is purposefully set longer than needed.
In
(b)
, the wrapper locates the first aligned address within the block and stores the original pointer just "behind" it. The aligned pointer (aptr) is returned to the application. Later, a wrapper around
free()
can retrieve the original pointer by looking behind aptr.
Flexible C++
Matthew Wilson
My approach to software engineering is far more pragmatic than it
is
theoretical--and no language better exemplifies this than C++.
BYTE Digest editors every month analyze and evaluate the best articles from Information Week, EE Times, Dr. Dobb's Journal, Network Computing, Sys Admin,
and dozens of other CMP publications—bringing
you critical news and information about wireless communication,
computer security, software development, embedded systems,
and more!