]> Devi Nivas Git - cs3210-lab1.git/commitdiff
Use static assert instead of _LP64 (thanks Eddie!)
authorFrans Kaashoek <kaashoek@mit.edu>
Tue, 11 Sep 2012 01:58:18 +0000 (21:58 -0400)
committerFrans Kaashoek <kaashoek@mit.edu>
Tue, 11 Sep 2012 01:58:18 +0000 (21:58 -0400)
mkfs.c

diff --git a/mkfs.c b/mkfs.c
index b50b503a5c86bdec1b2a0fedb707861973b6e14c..4b0e3298dc34166e03538cce509891d88f85bc00 100644 (file)
--- a/mkfs.c
+++ b/mkfs.c
@@ -11,9 +11,7 @@
 #include "stat.h"
 #include "param.h"
 
-#ifndef _LP64
-#error "Integers are not 32 bits"
-#endif
+#define static_assert(a, b) do { switch (0) case 0: case (a): ; } while (0)
 
 int nblocks = 985;
 int nlog = LOGSIZE;
@@ -68,6 +66,9 @@ main(int argc, char *argv[])
   char buf[512];
   struct dinode din;
 
+
+  static_assert(sizeof(int) == 4, "Integers must be 4 bytes!");
+
   if(argc < 2){
     fprintf(stderr, "Usage: mkfs fs.img files...\n");
     exit(1);