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

Re: [MiNT] setjmp.h and csetjmp



Something woke me up last night....
It was about my tiny patch in include/setjmp.h

After changing it several times, I finally made a special implementation of longjmp() for C++.
So the most logical and readable implementation should be :

#ifdef __cplusplus
// C++ specific version
#else
/* Normal version */
#endif

In my previous patch, I used #ifndef instead of #ifdef.
It does the same, but it is less logical.

I have attached a new patch to this message.
Frank, if you think this is better, you could commit it.
However, it will affect only the include readability, the generated code will be strictly the same.

If you think this has no importance, just ignore this message.
Sorry for the inconvenience.

Vincent
diff -aurN mintlib-CVS/include/setjmp.h mintlib-CVS-patch-20071215/include/setjmp.h
--- mintlib-CVS/include/setjmp.h	2007-12-15 10:25:53.000000000 +0100
+++ mintlib-CVS-patch-20071215/include/setjmp.h	2007-12-15 10:26:57.437500000 +0100
@@ -25,16 +25,16 @@
 #define _longjmp(__jb,__v)	(siglongjmp(__jb, __v))
 #define setjmp(__jb)		(sigsetjmp(__jb, 1))
 
-#ifndef __cplusplus
-#define longjmp(__jb,__v)	(siglongjmp(__jb, __v))
-#else /* __cplusplus */
+#ifdef __cplusplus
 // <csetjmp> needs a real function instead of a macro.
 static inline void
 longjmp (sigjmp_buf env, int val)
 {
 	siglongjmp(env, val);
 }
-#endif /* __cplusplus */
+#else /* not __cplusplus */
+#define longjmp(__jb,__v)	(siglongjmp(__jb, __v))
+#endif /* not __cplusplus */
 
 #endif /* __USE_BSD */