New LINT gag wanted

Johan Wide'n johanw at ttds.UUCP
Thu Mar 8 22:20:57 AEST 1984


Another feature that would be nice to have in connection with
braindamaged compilers with sizeof(int) != sizeof(char *) :
	Lint should tell you when the difference of two pointers
is taken. (The result is an int.)

To ensure portability we have been forced to hide the diff of pointers in
a macro. For a 32-bit pointer, 16-bit int machine this macro casts the
pointers into longs before taking the difference of them. This is not
a completely satisfactory solution as the difference should indicate
the number of objects between pointers, not just the number of bytes.

We are fed up with this sort of compiler and now have two compilers
on our MC68000-system. One compiler has 16-bit ints the other has 32-bit
ints. The 16-bit compiler can be used for showing of benchmarks, the 32-bit
is useful for porting programs to the MC68000.

Use of the 32-bit compiler requires that one links the programs not with
libc but a modified version of libc with rewritten systemcalls. That is:
the routine write.s which traps to the write system call must be changed
to take account of the fact that it's arguments are
	write(32-bit, (char *), 32-bit);
whereas the system expects
	write(16-bit, (char *), 16-bit);

{decvax,philabs}!mcvax!enea!ttds!johanw         Johan Widen



More information about the Comp.lang.c mailing list