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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!postnews.google.com!news2.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date Sun, 11 Mar 2012 08:02:59 -0500
Message-ID <4F5CB0C8.2C88@mindspring.com> (permalink)
Date Sun, 11 Mar 2012 09:03:52 -0500
From pete <pfiland@mindspring.com>
Reply-To pfiland@mindspring.com
Organization PF
X-Mailer Mozilla 3.04Gold (WinNT; I)
MIME-Version 1.0
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>
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
Lines 50
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 4.154.222.224
X-Trace sv3-jsqlAPOjBH65Bed1W0KGKUWql3ZCgrP872YcxNqx/YdZvLd61NZ/EeJi6+iJjjVtbGAjKKLABvI4Og5!/P47m4qk94EwzomhvILDyRSvEOc0ym/QDpDzVagw2xj4OzScoK1JJLB/TLGt0Bh89gAWqBluuYuR!0lFAEOke7zI=
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 2084
Xref csiph.com comp.lang.c:18531

Show key headers only | 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