toon-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Toon-members] TooN/internal size_mismatch.hh


From: Edward Rosten
Subject: [Toon-members] TooN/internal size_mismatch.hh
Date: Fri, 27 Mar 2009 14:03:51 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Edward Rosten <edrosten>        09/03/27 14:03:51

Modified files:
        internal       : size_mismatch.hh 

Log message:
        Make size mismatch fail in size_mismatch.hh for easier to read error 
messages.
        
        TOON_NDEBUG_SIZE to switch off run-time size checking for best 
performance
        
        Last log message should read:
        
        TOON_NDEBUG_SLICE to switch off run-time slice checking for best 
performance

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/size_mismatch.hh?cvsroot=toon&r1=1.2&r2=1.3

Patches:
Index: size_mismatch.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/size_mismatch.hh,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- size_mismatch.hh    26 Jan 2009 18:45:18 -0000      1.2
+++ size_mismatch.hh    27 Mar 2009 14:03:51 -0000      1.3
@@ -17,8 +17,8 @@
     if(size1!=size2){
          #ifdef TOON_TEST_INTERNALS
                throw Internal::SizeMismatch();
-         #else
-                 std::cerr << "Toon Size Mismatch" << std::endl;
+         #elif !defined TOON_NDEBUG_SIZE
+                 std::cerr << "TooN Size Mismatch" << std::endl;
                  std::abort();
          #endif
     }
@@ -31,8 +31,8 @@
     if(size1!=size2){
          #ifdef TOON_TEST_INTERNALS
                throw Internal::SizeMismatch();
-         #else
-                 std::cerr << "Toon Size Mismatch" << std::endl;
+         #elif !defined TOON_NDEBUG_SIZE
+                 std::cerr << "TooN Size Mismatch" << std::endl;
                  std::abort();
          #endif
     }
@@ -45,22 +45,28 @@
     if(size1!=size2){
          #ifdef TOON_TEST_INTERNALS
                throw Internal::SizeMismatch();
-         #else
-                 std::cerr << "Toon Size Mismatch" << std::endl;
+         #elif !defined TOON_NDEBUG_SIZE
+                 std::cerr << "TooN Size Mismatch" << std::endl;
                  std::abort();
          #endif
     }
   }
 };
 
+namespace Internal
+{
+       struct BadSize;
+}
 
-#ifdef TOON_TEST_INTERNALS
-  template<int Size1, int Size2>
-  struct SizeMismatch
-  {
+template<int Size1, int Size2>
+struct SizeMismatch
+{
     static inline void test(int, int)
     {
+               #ifdef TOON_TEST_INTERNALS
       throw Internal::StaticSizeMismatch();
+               #else
+                       Internal::BadSize size_mismatch;
+               #endif
     }
-  };
-#endif
+};




reply via email to

[Prev in Thread] Current Thread [Next in Thread]