Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Need Help Displaying of Infix to postfix conversion Date: Sun, 21 Aug 2016 18:17:02 -0700 Organization: None to speak of Lines: 35 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="4591"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/XfX4I5Ak+IZ8ay2IkoY4C" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:W9iAo/rDOpPjW0ko+HRYG3qa4r4= sha1:nt8o7N80/rqqZCfDB7JKHGef+Ww= Xref: csiph.com comp.lang.c:92574 BartC writes: > On 21/08/2016 23:43, Keith Thompson wrote: >> BartC writes: >>> On 21/08/2016 10:47, Own IT wrote: >> [...] >>>> char pop() >>> >>> Use char pop(void) here. (Otherwise it won't work with some compilers.) >> >> Certainly char pop(void) is preferred to the old-style char pop(), but >> any conforming C compiler will accept the older form. > > I thought it went badly wrong when using gcc, with pop(), but I've > done more tests and it happens with pop(void) too. I get this output > for '3*4': > > 3ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ .... > > instead of '34*'. Only when optimised. So there might be a bug either > in the code, or possibly with gcc. It's not a gcc bug, it's a bug in the code. The code accesses stack[-1]. It's not too surprising that the behavior differs with the optimization level. > (BTW you now seem to be posting from two hours in the future instead > of one...) Thanks, but again, it's not my machine, and I've done what I can. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"