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


Groups > comp.lang.c > #18945

Re: Method to test a program against different C implementations

From James Kuyper <jameskuyper@verizon.net>
Newsgroups comp.lang.c
Subject Re: Method to test a program against different C implementations
Date 2012-03-22 18:39 -0400
Organization A noiseless patient Spider
Message-ID <4F6BAA16.40706@verizon.net> (permalink)
References (1 earlier) <slrnjm4q3t.1ls.grahn+nntp@frailea.sa.invalid> <jju1kn$q8t$1@dont-email.me> <slrnjmi0h7.1ls.grahn+nntp@frailea.sa.invalid> <jkbf01$52h$1@dont-email.me> <slrnjmn7gn.1ls.grahn+nntp@frailea.sa.invalid>

Show all headers | View raw


On 03/22/2012 05:48 PM, Jorgen Grahn wrote:
> On Wed, 2012-03-21, Eric Sosman wrote:
>> On 3/20/2012 6:18 PM, Jorgen Grahn wrote:
...
>>> Perhaps I should mention that I looked past his unfortunate choice of
>>> words ("all possible C implementations..."). The idea was too
>>> interesting to be shot down that easily.
>>
>>      Even though "all possible" is easily and trivially shot down,
>> I believe that even "all of interest" is also expensive beyond
>> practicality.  It is certainly expensive beyond usefulness, that is,
>> more expensive than alternative approaches for assessing portability.
> 
> Now we're getting somewhere.
> 
> I don't see why "all of interest" would be impractical. I think I can
> enumerate them (and I think others did upthread). Let's take 
> x86_64 as a base and change these one by one:

x86_64 is not a C compiler; it's a platform on which many different
operating systems can run, and for each operating system, there's many
different C compilers that can run on that platform. Those C compilers
can vary in their characteristics for at least some of the items you
listed (and many others you didn't list).

> - no struct padding
> - excessive struct padding

That's not a single alternative to "no struct padding"; it's an infinite
multidimensional family of alternatives, depending upon the many
different ways padding can be inserted.

> - signed/unsigned 'char'
> - 16 bit char
> - 16 bit int
> - 64 bit int
> - one's complement
> - big-endian
> - unaligned access is fatal
> 
> That's less than a dozen, and you don't have to test all combinations.

Why not? It's trivial to come up with examples that fail only for
particular combinations of those differences, and not for any single
difference from whichever compiler "x86_64" was meant to refer to.

Every item you list has to do with differences in the way types are
represented, and all but the first two items have to do with how
integral types are represented - they come almost exclusively from
section 6.2.6. Are you really suggesting that such variations are the
only ones allowed by the C standard that are "of interest"?  I recommend
reviewing Annex J "Portability Issues" before answering that question.
Are NONE of the items on that list that come from outside section 6.2.6
"of interest"?

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