问题
What would be the meaning of these format specifiers?
%hd %hhd %ld %lld
回答1:
%hd is used for short integer
or unsigned short integer
%hhd is for short short integer
or unsigned short short integer
%ld is for long integer
or unsigned long integer
%lld is for long long integer
or unsigned long long integer
Simple as that.
Here h
, hh
, l
, ll
are just length modifiers in %d
Source: http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/Strings/Articles/formatSpecifiers.html
回答2:
Just look into the Documentation from Apple provided here: http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/Strings/Articles/formatSpecifiers.html
回答3:
I think this document from IBM is a bit better.So:
%hd int x (short)x 10 1
%ld long x (long)x 10 1
来源:https://stackoverflow.com/questions/17854628/ios-nslog-hd-hhd-ld-and-lld-format-specifiers