Thread View: net.micro.atari16
1 messages
1 total messages
Started by Ron Janzen
Wed, 16 Apr 1986 00:48
problem with C modulo operator using Developers Kit
Author: Ron Janzen
Date: Wed, 16 Apr 1986 00:48
Date: Wed, 16 Apr 1986 00:48
30 lines
1805 bytes
1805 bytes
There is a problem in the Atari Developer's Kit when using the
C modulo operator (%) when both operands are longs. The problem
appears in the following way. Consider this short program,
#include <stdio.h>
main()
{
long i;
for ( i = 0; i < 10; i++ )
printf( "i = %ld, i %% 3 = %ld\n", i, i % 3L );
}
If you compile this and link it with gemlib it will work as expected.
However if you link it with vdibind and gemlib (as you would in a
program that uses VDI routines) in that order, the result of the i % 3L
operation is garbage. We traced it down to the fact that both vdibind
and gemlib contain the lrem function which is used when finding the
modulo of two longs. Evidently the one in vdibind is buggy whereas the
one in gemlib works. Therefore when we linked with vdibind before
gemlib the buggy version was linked in. It seems to me that vdibind
shouldn't even contain this routine (it also contains lmul.o and
ldiv.o). These routines should be (and are) in the C runtime library
(gemlib). We just took them out of vdibind and everything works OK now.
Is there some reason these routines were in vdibind?
--
Ron Janzen
Ontario Science Centre, Toronto
...!{allegra,ihnp4,linus,decvax}!utzoo!oscvax!ron
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads