Index: examples/atoi.rl
===================================================================
--- examples/atoi.rl.orig
+++ examples/atoi.rl
@@ -3,8 +3,8 @@
  */
 
 #include <iostream>
-#include <stdlib.h>
-#include <stdio.h>
+#include <cstdlib>
+#include <cstdio>
 
 using namespace std;
 
Index: examples/concurrent.rl
===================================================================
--- examples/concurrent.rl.orig
+++ examples/concurrent.rl
@@ -3,8 +3,8 @@
  */
 
 #include <iostream>
-#include <stdlib.h>
-#include <stdio.h>
+#include <cstdlib>
+#include <cstdio>
 
 using namespace std;
 
Index: examples/cppscan.rl
===================================================================
--- examples/cppscan.rl.orig
+++ examples/cppscan.rl
@@ -3,8 +3,8 @@
  * << <= <<= >> >= >>= are left out since angle brackets are used in templates.
  */
 
-#include <string.h>
-#include <stdlib.h>
+#include <cstring>
+#include <cstdlib>
 #include <iostream>
 
 #define TK_Dlit 256
Index: examples/gotocallret.rl
===================================================================
--- examples/gotocallret.rl.orig
+++ examples/gotocallret.rl
@@ -8,8 +8,9 @@
  */
 
 #include <iostream>
-#include <stdlib.h>
-#include <stdio.h>
+#include <cstdlib>
+#include <cstdio>
+#include <cstring>
 
 using namespace std;
 
Index: examples/mailbox.rl
===================================================================
--- examples/mailbox.rl.orig
+++ examples/mailbox.rl
@@ -3,8 +3,9 @@
  */
 
 #include <iostream>
-#include <stdlib.h>
-#include <stdio.h>
+#include <cstdlib>
+#include <cstdio>
+#include <cstring>
 
 using namespace std;
 
Index: examples/rlscan.rl
===================================================================
--- examples/rlscan.rl.orig
+++ examples/rlscan.rl
@@ -3,8 +3,9 @@
  */
 
 #include <iostream>
-#include <stdlib.h>
-#include <stdio.h>
+#include <cstdlib>
+#include <cstdio>
+#include <cstring>
 
 using namespace std;
 
@@ -48,6 +49,11 @@ inline void write( char *data )
 	cout << data;
 }
 
+inline void write( const char *data )
+{
+	cout << data;
+}
+
 inline void write( char c )
 {
 	cout << c;
Index: examples/statechart.rl
===================================================================
--- examples/statechart.rl.orig
+++ examples/statechart.rl
@@ -5,8 +5,9 @@
  */
 
 #include <iostream>
-#include <stdlib.h>
-#include <stdio.h>
+#include <cstdlib>
+#include <cstdio>
+#include <cstring>
 
 using namespace std;
 
Index: test/cppscan1.h
===================================================================
--- test/cppscan1.h.orig
+++ test/cppscan1.h
@@ -2,6 +2,8 @@
 #define _CPPSCAN1_H
 
 #include <iostream>
+#include <cstdlib>
+#include <cstring>
 
 using namespace std;
 
Index: test/cppscan2.rl
===================================================================
--- test/cppscan2.rl.orig
+++ test/cppscan2.rl
@@ -3,6 +3,7 @@
  */
 
 #include <iostream>
+#include <cstring>
 using namespace std;
 
 #define TK_Dlit 192
Index: test/repetition.rl
===================================================================
--- test/repetition.rl.orig
+++ test/repetition.rl
@@ -5,8 +5,9 @@
 /* Test repeptition operators. */
 
 #include <iostream>
-#include <stdlib.h>
-#include <stdio.h>
+#include <cstdlib>
+#include <cstdio>
+#include <cstring>
 
 using namespace std;
 
Index: test/union.rl
===================================================================
--- test/union.rl.orig
+++ test/union.rl
@@ -4,8 +4,9 @@
  */
 
 #include <iostream>
-#include <stdlib.h>
-#include <stdio.h>
+#include <cstdlib>
+#include <cstdio>
+#include <cstring>
 
 using namespace std;
 
Index: common/common.h
===================================================================
--- common/common.h.orig
+++ common/common.h
@@ -195,7 +195,7 @@ struct KeyOps
 	HostType *typeSubsumes( bool isSigned, long long maxVal )
 	{
 		for ( int i = 0; i < hostLang->numHostTypes; i++ ) {
-			if ( ( isSigned && hostLang->hostTypes[i].isSigned || !isSigned ) &&
+			if ( ( ( isSigned && hostLang->hostTypes[i].isSigned ) || !isSigned ) &&
 					maxVal <= hostLang->hostTypes[i].maxVal )
 				return hostLang->hostTypes + i;
 		}
