Topic: Is Inline op new Legal?
Author: Michiel Salters<Michiel.Salters@cmg.nl>
Date: Tue, 23 Oct 2001 18:26:41 GMT Raw View
In article <3BD4139C.4FC3A89F@nortelnetworks.com>, John Hickin says...
>
>
>I've got a compiler that complains that inline operator new is illegal;
>at least that's the way it looks. More specifically, the warning (or
>error, if anachronisms are not allowed) mentions that operator new is
>first seen as having external linkage and later on seen as inline. I can
>see two possible outcomes:
>
>1) it is illegal because operator new always has to have external
>linkage
>2) it is legal because the compiler is free to ignore the inline hint
>
>TIA, John.
I guess the compiler "is thinking of" 3.7.3/2; operator new is implicitly
declared as void* operator new(std::size_t) throw(std::bad_alloc); and
1.4/6; library-defined operators have external linkage.
Still, you can replace it with a function with the same signature. "inline"
doesn't affect the signature.
So I'd say it's legal because there shouldn't be an operator new with external
linkage interfering with your operator.
Of course, I might have missed explicit wording to the contrary.
Regards,
Michiel Salters
--
Michiel Salters
Consultant Technical Software Engineering
CMG Trade, Transport & Industry
Michiel.Salters@cmg.nl
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]
Author: "John Hickin" <hickin@nortelnetworks.com>
Date: Mon, 22 Oct 2001 19:35:12 GMT Raw View
I've got a compiler that complains that inline operator new is illegal;
at least that's the way it looks. More specifically, the warning (or
error, if anachronisms are not allowed) mentions that operator new is
first seen as having external linkage and later on seen as inline. I can
see two possible outcomes:
1) it is illegal because operator new always has to have external
linkage
2) it is legal because the compiler is free to ignore the inline hint
TIA, John.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]