M
mackenzie
I was wondering why it is "ill-formed if an allocation function is
declared in a namespace"? I have done some searching on the web and
can not find a reason why; I have stumbled across a few other users
asking similar questions but there are no definitive replies that I
could find.
To me a namespace specifies a set of functionality. From an
application point of view a namespace could easily specify a set of
interrelated processes and the objects which those processes operate
upon. In some applications those objects might be easily accessed
(with semaphore protection) using a shared memory segment. In this
case one would not want to overload the global new operator; however,
one may want to overload an operator new function which applies only
to that particular name space. This scoped operator new would
dynamically allocate memory from a shared memory system for the set of
processes and objects described by the namespace.
function; a program is ill-formed if an allocation function is
declared in a namespace scope other than global scope or declared
static in global scope."
and
"Deallocation functions shall be class member functions or global
functions; a program is ill-formed if deallocation functions are
declared in a namespace scope other than global scope or declared
static in global scope."
Thank you,
Parker Mackenzie
declared in a namespace"? I have done some searching on the web and
can not find a reason why; I have stumbled across a few other users
asking similar questions but there are no definitive replies that I
could find.
To me a namespace specifies a set of functionality. From an
application point of view a namespace could easily specify a set of
interrelated processes and the objects which those processes operate
upon. In some applications those objects might be easily accessed
(with semaphore protection) using a shared memory segment. In this
case one would not want to overload the global new operator; however,
one may want to overload an operator new function which applies only
to that particular name space. This scoped operator new would
dynamically allocate memory from a shared memory system for the set of
processes and objects described by the namespace.
"An allocation function shall be a class member function or a globalFrom the standard:
function; a program is ill-formed if an allocation function is
declared in a namespace scope other than global scope or declared
static in global scope."
and
"Deallocation functions shall be class member functions or global
functions; a program is ill-formed if deallocation functions are
declared in a namespace scope other than global scope or declared
static in global scope."
Thank you,
Parker Mackenzie