cpp: tidy up unneeded closing markers
cpp: tweak casting snippets