N-functions and the weak comparison principle