Do functions check size/rank of input arrays? If not why?

Yeah I this is another case of Knuth’s gold rule, “premature optimization is the root of all evil”. You were just trying to code the reshape function yourself!