darling/tools/sizeof
Andrew Hyatt 5f96f6c7fb
Rename tools to remove their file extensions
This makes it easy to add the folder to PATH and run commands
2018-05-17 10:02:35 -04:00

26 lines
263 B
Bash
Executable File

#!/bin/sh
set -e
cfile=/tmp/sizeof.$$.cpp
include="$1"
struct="$2"
cat > $cfile <<END
#include <stdio.h>
#include <$include>
int main()
{
printf("sizeof($struct)=%d\n", sizeof($struct));
return 0;
}
END
g++ -w $cfile -o $cfile.bin
$cfile.bin
rm $cfile*