Difference between NSLog and NSLogv

后端 未结 3 1550
遥遥无期
遥遥无期 2021-01-12 11:44

Can anyone explain the difference between NSLog and NSLogv? I know NSLog is used to print data in the console. But what is NSLogv?

3条回答
  •  耶瑟儿~
    2021-01-12 12:44

    Generally speaking, a suffix of v means that a function takes a va_list as an argument, instead of a variadic argument list.

    This is the case for NSLog and NSLogv:

    void NSLog(NSString *format, ...);
    
    void NSLogv(NSString *format, va_list args);
    

    This is useful in certain very specific situations where you need to "wrap" a function that takes variadic arguments. If you need it, you'll know. Otherwise, you can safely ignore it.

提交回复
热议问题