]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/gc: avoid %#x of 0
authorRuss Cox <rsc@golang.org>
Thu, 1 Nov 2012 16:55:21 +0000 (12:55 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 1 Nov 2012 16:55:21 +0000 (12:55 -0400)
Plan 9 and Go's lib9/fmt disagree on whether %#x includes the 0x prefix
when printing 0, because ANSI C gave bad advice long ago.

Avoiding that case makes binaries compiled on different systems compatible.

R=ken2
CC=akumar, golang-dev
https://golang.org/cl/6814066

src/cmd/gc/esc.c

index a2bcbae8fe204227be2ab8c3d9ff74bab6d1b739..6ac0ea530ffb6512686a2e2e5403d446b66927fa 100644 (file)
@@ -233,7 +233,7 @@ mktag(int mask)
        if(mask < nelem(tags) && tags[mask] != nil)
                return tags[mask];
 
-       snprint(buf, sizeof buf, "esc:%#x", mask);
+       snprint(buf, sizeof buf, "esc:0x%x", mask);
        s = strlit(buf);
        if(mask < nelem(tags))
                tags[mask] = s;