Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!samsung!sdd.hp.com!caen!kuhub.cc.ukans.edu!markv From: markv@kuhub.cc.ukans.edu Newsgroups: comp.sys.amiga.programmer Subject: Re: Manx/Lattice divergant behaviour Message-ID: <29017.27db6b70@kuhub.cc.ukans.edu> Date: 11 Mar 91 17:35:12 GMT References: <1001@caslon.cs.arizona.edu> Organization: University of Kansas Academic Computing Services Lines: 44 In article <1001@caslon.cs.arizona.edu>, dave@cs.arizona.edu (Dave P. Schaumann) writes: > I've come across a curious incompatability between Manx and Lattice, and > I'm hoping that someone can clear the air for me. > >Through the course of events, a friend and I both compiled the following code. >I with Manx 3.6a, he with a Lattice compiler (sorry, don't know the version): > > /* Please excuse any typos; I typed this from memory. > */ > #include > > main() { > > FILE *my_win ; > int c ; > > if( (my_win = fopen( "CON:10/10/100/200/C window", "a+" )) == NULL ) { > puts( "Can't open window!" ) ; exit(1) ; You may be running into the fact that CON: is an Interactive stream device and does not support seeking, so I wouldn't count on the behavior of anything like fseek() or something that might call it implicitly like an "a+" mode stream. Try "r+" or "w+". > My version of this works fine. The version compiled with Lattice sees EOF > at fgetc() the first time it is executed, and exits immediately, whatever > the input is. Probably Lattice is calling Seek() (Amiga DOS) internally which will fail on CON:, and then returns an EOF because of it. > My question is: is the Lattice compiler broken/deficient, or is this an > example of code with undefined behaviour? -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Mark Gooderum Only... \ Good Cheer !!! Academic Computing Services /// \___________________________ University of Kansas /// /| __ _ Bix: mgooderum \\\ /// /__| |\/| | | _ /_\ makes it Bitnet: MARKV@UKANVAX \/\/ / | | | | |__| / \ possible... Internet: markv@kuhub.cc.ukans.edu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~