Warning: QLC (Lattice C 3.02) has one really horrible bug in stdio.h. When it returns EOF (which must be an int - that was always so, even in K&R C), it returns a char. As char is signed on the 68000, when the character code FF (decimal 255) exists in a file, it is sign extended and EOF (-1) is returned. This makes the stdio functions nearly unusable for binary data. BTW: The first versions of C68 have had the same bug.
Correct behaviour is: Return 0xFF (255) as an int (0x00FF) for the character code 0xFF and -1 as int (0xFFFF) for EOF.
BTW: For your example you should at least get a warning if you change it to:
Code: Select all
#include <mdv1_stdio_h>
#include <mdv1_math_h>
double pow(double, double); /* Lattice C supports function prototypes, albeit not ANSI-C compatible */
main()
{
double ov2;
ov2 = pow(2,2);
printf("%f\n", ov2);
}
http://peter-sulzer.bplaced.net
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function
EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX
