Newsgroups: comp.sys.apple2 Path: utzoo!utgpu!news-server.csri.toronto.edu!helios.physics.utoronto.ca!aurora.physics.utoronto.ca!neufeld From: neufeld@aurora.physics.utoronto.ca (Christopher Neufeld) Subject: Re: Orca/C Bug? Message-ID: <1991Mar10.003000.13347@helios.physics.utoronto.ca> Sender: news@helios.physics.utoronto.ca (News Administrator) Nntp-Posting-Host: aurora.physics.utoronto.ca Organization: University of Toronto Physics/Astronomy/CITA References: <9103081247.AA24460@apple.com> Date: Sun, 10 Mar 1991 00:30:00 GMT Another one which got me for several hours last night: I have main(), which passes by value to a subroutine, which passes that same value to yet another subroutine, which writes it to a file with fwrite(). The bytes being written to the file were just plain wrong until I made a change to the savedata() routine: doesn't work: void savedata(a,b,c,...,g) int a; double b,c,**d,**e, etc. { [ fopen ] fwrite (&b,sizeof(b),1,file); ..... return; } It does work when I make the following change: [ as before ] { double hold; [ fopen ] hold = b; fwrite (&hold,sizeof(hold),1,file); .... return; } It looks like the pointer to a passed parameter isn't properly defined. It writes the integer properly, and has no trouble with the **double types, but double gets weird. A possibly related problem is that the 'variables' window in the debugger under Prizm, on the rare occasions that I use it, will not display the value of some variables passed as double, printing **.*** instead, though the variables evaluate properly in algebraic equations. It seems that functions which explicitly make use of the pointer mess up, while those which use the value don't have trouble. -- Christopher Neufeld....Just a graduate student | Note: new host. neufeld@aurora.physics.utoronto.ca Ad astra! | helios will still cneufeld@{pnet91,pro-cco}.cts.com | forward my mail to "Don't edit reality for the sake of simplicity" | me on aurora.