1
0
mirror of https://github.com/golang/go synced 2024-11-19 23:04:40 -07:00

cmd/gc: avoid %#x of 0

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
This commit is contained in:
Russ Cox 2012-11-01 12:55:21 -04:00
parent c128474a7d
commit e4cef96be6

View 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;