Martijn Lievaart <[EMAIL PROTECTED]> writes:

> Sam Varshavchik wrote:
>
>>>>> void main()
>>>>
>>
>> Then your C compiler has a bug.
>>
>>
>
> No. Look up te C standard. main returns an int. Always. Always has,
> always will. Compilers that accept void main are non comforming.
>
> M4

The following version yields the same results.  The warning that says
"return type of `main' is not `int'" is not relevant to the main point
of this program.  It compiles with no errors and prints "Sam is right":

#include <stdio.h>

int main()
{
  int i;
  
  for (i=0; i<256; i++)
    {
      char c=(char)i;
      unsigned char uc=(unsigned char)i;
      
      if ( (((c >> 7) & 1) != ((uc >> 7) & 1)) ||
           ((c & 15) != (uc & 15)))
        {
          printf("Sam is wrong\n");
          exit(0);
        }
    }
  printf("Sam is right\n");
  return (0);
}


-- 
 Lloyd Zusman
 [EMAIL PROTECTED]
 God bless you.



-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to