useful C base functions