home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / TURBOM2 / M2BUGDEM.MOD < prev    next >
Text File  |  2000-06-30  |  768b  |  27 lines

  1. (******************************
  2. This program demonstrates that the ORD function doesn't always return the
  3. correct value for a CHAR variable and that the statement "c := C^;" moves a
  4. 16 bit value at address C to the CHAR variable c.  Both have caused serious
  5. gas pains!  Is there a fix or Modula2 update available?
  6. **********************************)
  7.  
  8. MODULE M2BugDemo;
  9. FROM STORAGE IMPORT ALLOCATE;
  10. FROM SYSTEM  IMPORT ADDRESS, FILL;
  11.  
  12. VAR
  13.   A     : ADDRESS;
  14.   c     : CHAR;
  15.   C     : POINTER TO CHAR;
  16.   i     : CARDINAL;
  17.  
  18. BEGIN
  19.   ALLOCATE (A, 10);
  20.   FILL (A, 10, 97);
  21.   FOR i := 0 TO 9 DO
  22.     C := A + i;
  23.     c := C^;
  24.     WRITELN (c, ORD (c));
  25.     END;
  26. END M2BugDemo.
  27.