[swift-users] Printing large hexadecimal values

Jacob Bandes-Storch jtbandes at gmail.com
Wed May 25 15:49:34 CDT 2016

I'm not sure this is strictly necessary, but I think it's a good idea to
explicitly use the "C*" types when doing formatting with varargs, to make
sure the calling convention matches what the callee expects:

    String(format: "%llx", CLongLong(myNumber))

On Wed, May 25, 2016 at 1:19 PM, Jens Alfke via swift-users <
swift-users at swift.org> wrote:

> On May 25, 2016, at 12:10 PM, Ken Burgett <kenb at iotone.io> wrote:
> You are correct, the "%llx" works for UInt64, while "%16x" does not.
> "%llX" also works, producing an uppercase string.
> Should this be reported as a bug?
> No, it’s correct behavior. You need to use the “ll” ("long long") modifier
> to specify that the parameter is a 64-bit value.
> —Jens
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160525/bc0d1dbc/attachment.html>

More information about the swift-users mailing list