diff options
author | rubidium <rubidium@openttd.org> | 2009-11-11 21:15:58 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-11-11 21:15:58 +0000 |
commit | 485b5a9c2fc1840255a0fe2fe7a1dd3f4d0e0130 (patch) | |
tree | 7ad968ec694d6acaf54711b090f88c9973590be3 /src/window_gui.h | |
parent | 285d25e01bff95ce845f4b92efa9ce0253b66429 (diff) | |
download | openttd-485b5a9c2fc1840255a0fe2fe7a1dd3f4d0e0130.tar.xz |
(svn r18045) -Fix: GCC 4.5@HEAD not compiling OpenTTD anymore because of a "non-placement deallocation function [is] selected for placement delete", or in other words delete(void *, size_t) is 'magic'.
We implemented these delete(void *, size_t) operator functions because MSVC warned that "no matching operator delete found; memory will not be freed if initialization throws an exception" for new(size_t, size_t).
This disables MSVC warning about this because we do not use exceptions in the (constructors that use the) overridden allocation functions, as such they will never be called; delete(void *) remains necessary though.
Diffstat (limited to 'src/window_gui.h')
-rw-r--r-- | src/window_gui.h | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/window_gui.h b/src/window_gui.h index 4cd4c990b..57fcd5a02 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -345,11 +345,26 @@ public: Window(); virtual ~Window(); - /* Don't allow arrays; arrays of Windows are pointless as you need - * to destruct them all at the same time too, which is kinda hard. */ - FORCEINLINE void *operator new[](size_t size) { NOT_REACHED(); } - /* Don't free the window directly; it corrupts the linked list when iterating */ - FORCEINLINE void operator delete(void *ptr) {} + + /** + * Helper allocation function to disallow something. + * Don't allow arrays; arrays of Windows are pointless as you need + * to destruct them all at the same time too, which is kinda hard. + * @param size the amount of space not to allocate + */ + FORCEINLINE void *operator new[](size_t size) + { + NOT_REACHED(); + } + + /** + * Helper allocation function to disallow something. + * Don't free the window directly; it corrupts the linked list when iterating + * @param ptr the pointer not to free + */ + FORCEINLINE void operator delete(void *ptr) + { + } uint16 flags4; ///< Window flags, @see WindowFlags WindowClass window_class; ///< Window class |