Use initializer list for arrays instead of memset

... for arrays, to have them zero value initialized.
Use calloc(1, size) instead of malloc + memset.
Use numeric_limits instead of dangerous magic numbers where possible.