Skip to content

Instantly share code, notes, and snippets.

@lucmann
Created May 31, 2023 00:09
Show Gist options
  • Save lucmann/38cff22c3f4a12a995ffc5c37330ee05 to your computer and use it in GitHub Desktop.
Save lucmann/38cff22c3f4a12a995ffc5c37330ee05 to your computer and use it in GitHub Desktop.
echo "#include <stdio.h>\nint main() { int a = sizeof(struct {}); printf(\"a = %d\\\n\", a); }" | gcc -x c -
# a = 0
echo "#include <stdio.h>\nint main() { int a = sizeof(struct {}); printf(\"a = %d\\\n\", a); }" | gcc -x c++ -
# <stdin>:2:36: error: types may not be defined in ‘sizeof’ expressions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment