From: myknees AT aol DOT com (Myknees) Newsgroups: comp.os.msdos.djgpp Subject: Re: gcc 2.7.2.1: Won't compile | or || symbols (really!) Lines: 84 Message-ID: <1998090623100300.TAA28060@ladder01.news.aol.com> NNTP-Posting-Host: ladder01.news.aol.com Date: 06 Sep 1998 23:10:03 GMT References: Organization: AOL http://www.aol.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk In article , JAU-BING LIN writes: >Subject: Re: gcc 2.7.2.1: Won't compile | or || symbols (really!) >From: JAU-BING LIN >Date: Sun, 6 Sep 1998 02:33:54 -0500 (CDT) > > > >On Sat, 5 Sep 1998 richard AT wynne DOT demon DOT co DOT uk wrote: > >> Just installed gcc 2.7.2.1 (from djgpp distribution). Believe it or >> not, I can't get logical or bitwise OR (pipe symbol) to compile. Get >> message "parse error before character 0335", 335 being the (octal) >> ascii for the pipe character. For example, this won't compile: >> >> int main (int argc, char * argv[]) { >> if((argc == 1) || (argc == 2)) { >> return 1; >> } else { >> return o; >> } >> } > >I guess the fllowing may work without using OR > > int main (int argc, char * argv[]) > { > if (argc == 1) > return 1; > else if (argc == 2) > return 1; > else > return 0; > > } I don't think there's anything wrong with the original version except that there is a lowercase 'o' where the zero should be (in main's return statement.) cd c:/elc/djgpp/works/tester/pipechar/ gcc -Wall pipechar.c pipechar.c: In function `main': pipechar.c:5: `o' undeclared (first use this function) pipechar.c:5: (Each undeclared identifier is reported only once pipechar.c:5: for each function it appears in.) pipechar.c:7: warning: control reaches end of non-void function Compilation exited abnormally with code 1 at Sun Sep 6 19:02:53 ----------------- ...then after changing the 'o' to '0': cd c:/elc/djgpp/works/tester/pipechar/ gcc -Wall pipechar.c Compilation finished at Sun Sep 6 19:03:46 [W95]:sh3 pipechar$ cat testit.sh #! $DJGPP/bin/sh echo a a echo $? echo a onearg a onearg echo $? echo a onearg twoarg a onearg twoarg echo $? [W95]:sh3 pipechar$ testit a 1 a onearg 1 a onearg twoarg 0 [W95]:sh3 pipechar$ --Ed (Myknees)