tho c++ giving readable error instead of segfaulting is quite surprise