Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Robert Miles <robertmilesxyz@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Method to test a program against different C implementations |
| Date | 2012-03-15 17:41 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <2041553.290.1331858493425.JavaMail.geo-discussion-forums@yncd8> (permalink) |
| References | <jji27a$d4e$1@nnrp.ngi.it> |
On Sunday, March 11, 2012 6:27:38 AM UTC-5, pozz wrote: > We perfectly know that C implementations can be very different in terms of: > - number of bits per byte > - number of bytes per int > - number of bytes per long > - signed or unsigned char > - negative number implementation (two's or one's complement) > - big or little endian or others > > I'm asking if there's a way to test a small C source (a function or a > small set of functions) against all possible C implementations. Of > course I'm thinking of an automatic test, because the number of C > implementations is high. > > I think this could be done with an ad-hoc C compiler that can be > configured (I imagine thorugh command-line parameteres) in several ways. > For example, I can say to the compiler to use signed or unsigned char > (when the signedness is not specified), 16-bit ints and 32-bit longs, > big-ending representation, two's complement for negative numbers. > > So I can write a small script that runs the compiler several times with > different configurations, producing different executables. Now I can > run these exe and compare the results (their outputs) against "the > correct output" I prepared before. > > I think this test could be very useful to verify the correctness of our > sources not only against the implementation where we are developing, but > also for other possible implementations that could be used in the future > by the users of our program. Should be possible if you have all possible C compilers available. That will also mean having most types of computers they can run on. There are many variations that do not reduce to simple numbers.
Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll 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