gcc gives "warning: unused variable ‘type’" here