Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #18531

Re: Method to test a program against different C implementations

Message-ID <4F5CB0C8.2C88@mindspring.com> (permalink)
Date 2012-03-11 09:03 -0500
From pete <pfiland@mindspring.com>
Organization PF
Newsgroups comp.lang.c
Subject Re: Method to test a program against different C implementations
References <jji27a$d4e$1@nnrp.ngi.it> <jji6up$68s$1@online.de>

Show all headers | View raw


Joachim Schmitz wrote:
> 
> pozz wrote:
> > We perfectly know that C implementations can be very different in
> > terms of:
> > - number of bits per byte
> 
> #include <limits.h>
>  and use CHAR_BIT
> 
> > - number of bytes per int
> 
> sizeof(int);
> 
> > - number of bytes per long
> 
> sizeof(long)
> 
> > - signed or unsigned char
> 
> #include <limits.h>
> and look at CHAR_BIT, CHAR_MAX and CHAR_MIN
> 
> > - negative number implementation (two's or one's complement)

    
#include <stdio.h>

    fputs("Negative numbers are ", stdout);
    switch (-1 & 3) {
        case 1: puts ("sign and magnitude.");
                break;
        case 2: puts ("one's complement.");
                break;
        case 3 : puts("two's complement.");
                break;
        default : puts("something strange.");
                break;
    }

> > - big or little endian or others
> 
> http://c-faq.com/misc/endiantest.html
> 
> <snip>
> 
> Bye, Jojo

-- 
pete

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Method to test a program against different C implementations pozz <pozzugno@gmail.com> - 2012-03-11 12:27 +0100
  Re: Method to test a program against different C implementations "Joachim Schmitz" <nospam.jojo@schmitz-digital.de> - 2012-03-11 13:48 +0100
    Re: Method to test a program against different C implementations pete <pfiland@mindspring.com> - 2012-03-11 09:03 -0500
      Re: Method to test a program against different C implementations James Kuyper <jameskuyper@verizon.net> - 2012-03-11 10:43 -0400
  Re: Method to test a program against different C implementations Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-03-11 09:08 -0400
    Re: Method to test a program against different C implementations pozz <pozzugno@gmail.com> - 2012-03-11 22:12 +0100
      Re: Method to test a program against different C implementations Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-03-11 17:44 -0400
  Re: Method to test a program against different C implementations Don Y <this@isnotme.com> - 2012-03-11 09:39 -0700
  Re: Method to test a program against different C implementations Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-03-15 22:09 +0000
    Re: Method to test a program against different C implementations James Kuyper <jameskuyper@verizon.net> - 2012-03-15 18:32 -0400
      Re: Method to test a program against different C implementations pozz <pozzugno@gmail.com> - 2012-03-17 16:26 +0100
        Re: Method to test a program against different C implementations James Kuyper <jameskuyper@verizon.net> - 2012-03-17 11:52 -0400
    Re: Method to test a program against different C implementations Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-03-15 20:31 -0400
      Re: Method to test a program against different C implementations Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-03-20 22:18 +0000
        Re: Method to test a program against different C implementations Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-03-20 22:38 -0400
          Re: Method to test a program against different C implementations Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-03-22 21:48 +0000
            Re: Method to test a program against different C implementations James Kuyper <jameskuyper@verizon.net> - 2012-03-22 18:39 -0400
            Re: Method to test a program against different C implementations Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-03-22 21:07 -0400
  Re: Method to test a program against different C implementations Robert Miles <robertmilesxyz@gmail.com> - 2012-03-15 17:41 -0700

csiph-web