Path: utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!bu-cs!composer From: composer@bu-cs.BU.EDU (Jeff Kellem) Newsgroups: gnu.gcc Subject: Re: gcc 1.34, can't printf "%" Keywords: printf C Message-ID: <29871@bu-cs.BU.EDU> Date: 19 Apr 89 23:48:36 GMT References: <8904192118.AA09440@garnet.berkeley.edu> Reply-To: composer@bu-cs.bu.edu (Jeff Kellem) Followup-To: gnu.gcc Organization: Boston University Lines: 31 In article <8904192118.AA09440@garnet.berkeley.edu> rusty@GARNET.BERKELEY.EDU writes: >The following program > >main() { > printf("\%d\n"); >} > >gets the complaint "warning: unknown escape sequence `\%'". Is there >some command-line flag I can use or is this a bug? Ok, well, gcc may give the warning, but the compiled program still will give you the same response as cc, thought not very useful and not the same across architectures. What are you trying to do? If you want to have the string "%d" printed (with a newline), then you'd do: printf("%%d\n"); That is part of how printf() interprets the format string. cc and gcc on both a Sun 3/280 running Sun Unix 4.2 R3.4 and an Encore Multimax running UMAX 3.3 produce the equivalent result on each machine. That is, on the Sun, both printed '0' and on the Multimax, both printed -4664 (or something like that). Of course, then the original printf has no use (that I can see), if you did not want to print "%d". Hope that helps... -jeff Jeff Kellem INTERNET: composer@bu-cs.bu.edu (or composer%bu-cs.bu.edu@bu-it.bu.edu) UUCP: ...!harvard!bu-cs!composer