unixpickle / alux

A lightweight C++ kernel designed to run a JavaScript or Dart VM
BSD 2-Clause "Simplified" License
21 stars 5 forks source link

Use static assertions to test structure size. #4

Closed joskuijpers closed 10 years ago

joskuijpers commented 10 years ago

As you seem to be using c++11, I added static_assertions, a feature of c++11. There is a version of static assert for C too, and for non-c++11 in clang: _Static_assert, if you are interested.

I think using static assertions to assert struct sizes is safe than using runtime assertions, or no assertions at all.

unixpickle commented 10 years ago

Wow, I just noticed that you wrote 0xa0 instead of 0x0a, but it's okay, I fixed it :smile:

joskuijpers commented 10 years ago

That was your fault then, because your comments said 0xa0: https://github.com/joskuijpers/alux/commit/05cf3e9a06a58623617748546dee3d783815e06b#diff-be02d6f464c03e007e52d8041d74f990L95

:smile: