Mail Archives: djgpp/1998/09/06/19:15:24
In article <Pine DOT A32 DOT 3 DOT 91 DOT 980906022606 DOT 27528A-100000 AT broncho DOT ucok DOT edu>,
JAU-BING LIN <jl1013 AT broncho DOT ucok DOT edu> writes:
>Subject: Re: gcc 2.7.2.1: Won't compile | or || symbols (really!)
>From: JAU-BING LIN <jl1013 AT broncho DOT ucok DOT edu>
>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)
- Raw text -