Sirs,
I am puzzled. I am using gpc on a unix system (Irix 6.5). When the compiler was built, we had to turn off the -g flag everywhere in the Makefiles(which, we understand, is a common problem) in order to complete the build. Below is a small program which simply writes out a real number using 'writeln'. It compiles fine, but generates garbage output:
program testprog(input,output); var x : real;
begin x := 10.0; writeln('The value of x is ',x); end.
This code produces the following line of output on my machine(SGI):
The value of x is /// /////////e-//8//8
What's up with this???? Thanks for any help you can give. Stuart Pope
*****************************************************************************
Stuart Pope Mail Stop 931 COMPUTER SCIENCES CORP. (757) 864-5775 (Voice) GEOLAB/ISSD (757) 864-8910 (FAX) Hampton, VA Email: d.s.pope@larc
Check out our webpage at http://geolab.larc.nasa.gov/
(No animals were harmed or killed in the generation of this mail message)
*****************************************************************************
Hello, Stuart Pope,
you wrote:
writeln('The value of x is ',x); [...] The value of x is /// /////////e-//8//8
Which version of GPC are you running? This information is important for us if we want to give useful help. (If you are not sure, please type `gpc -v'.)
Peter
Stuart Pope wrote:
I am puzzled. I am using gpc on a unix system (Irix 6.5). When the
compiler was built, we had to turn off the -g flag everywhere in the Makefiles(which, we understand, is a common problem) in order to complete the build. Below is a small program which simply writes out a real number using 'writeln'. It compiles fine, but generates garbage output:
program testprog(input,output); var x : real;
begin x := 10.0; writeln('The value of x is ',x); end.
This code produces the following line of output on my machine(SGI):
The value of x is /// /////////e-//8//8
What's up with this????
That's a known bug on IRIX (listed on the To-Do list, http://agnes.dida.physik.uni-essen.de/~gnu-pascal/todo.html).
(Peter, this will be fixed by getting rid of the varargs stuff in the RTS.)
For now, there's a work-around (in recent GPC versions). Please look for `LongReal2Str' in the `GPC' unit. The following should work. Sorry for the inconvenience.
program testprog(input,output);
uses GPC;
var x : real;
begin x := 10.0; writeln('The value of x is ', LongReal2Str (x, NoWidth, NoPrecision)); end.
Frank