🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4070

Re: Converting between pointer types

#4070
From: Christopher R. Volpe
Date: Wed, 20 Sep 1995 22:38
56 lines
3145 bytes
In article <43q1ko$q5s@Radon.Stanford.EDU>, becker@Xenon.Stanford.EDU (Denizen of the Deep) writes:
>In article <DF6uIu.D8t@stdc.demon.co.uk>,
>Clive D.W. Feather <clive@demon.net> wrote:
>>
>>If there is a conforming implementation that will accept your program,
>>then it is a conforming program. Just not strictly conforming.
>>
>
>So if I write a program which invokes undefined behavior all over
>the place, but I can find one conforming implementation which will
>accept it, then I can say that my program is a conforming C
>program?

That's why the term "conforming program" is useless. One can write a
conforming C compiler that accepts a fortran program, prints a message that
says "Warning: This is a fortran program" to satisfy the one required
diagnostic, and correctly translates and executes the fortran program.
Henceforth all Fortran programs become conforming C programs. 

I have no idea what the committee was thinking.

>What exactly does it mean to say that an implementation "accepts"
>a program?  That it successfully compiles it (with or without
>non-fatal warnings)?

Very good question. The Standard never defines it. The Standard does require a
conforming implementation to "accept" every strictly conforming program. But
this doesn't mean "translate and execute", since a conforming implementation
need only "translate and execute" one, count 'em, *one* strictly conforming
program, and that program need not produce any output.  The vendor can claim
that their implementation correctly translates and executes a single program,
which meets each of the translation limits, but doesn't print anything out.
It's like proving your dog can do arithmetic by asking him what four minus
four is, and showing everyone that he barked zero times, which is the correct
answer.

The result is a loophole big enough to drive a truck through. The following
is a conforming C "interpreter":

=====================================
#!/bin/csh
# Make sure we "accept" every strictly conforming program
echo "I accept this program"

# Issue the required diagnostic for any syntax err or constraint violation
echo "Warning: This program may contain a syntax or constraint violation"

# Scream "translation limits!" to justify not executing the user's code
echo "Warning: If I don't correctly translate and execute this program,"
echo "it's because ANSI Classic 2.2.4.1 says I don't have to. Sorry."

--

Chris Volpe				Phone: (518) 387-7766 (Dial Comm 8*833
GE Corporate R&D			Fax:   (518) 387-6560
PO Box 8, Schenectady, NY 12301		Email: volpecr@crd.ge.com
Technical Details
Message-ID: <43q559$9bm@rdsunx.crd.ge.com>
Path: arc1-ca.pugleaf.net!bart.crd.ge.com!volpe
References: <43n718$ns@Radon.Stanford.EDU> <DF6uIu.D8t@stdc.demon.co.uk> <43q1ko$q5s@Radon.Stanford.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!bart.crd.ge.com!volpe
From: volpe@bart.crd.ge.com (Christopher R. Volpe)
Newsgroups: comp.std.c
Subject: Re: Converting between pointer types
Date: 20 Sep 1995 22:38:33 GMT
Organization: GE Corporate Research & Development
Sender: volpe@bart (Christopher R. Volpe)
Distribution: world
Message-ID: <43q559$9bm@rdsunx.crd.ge.com>
References: <43n718$ns@Radon.Stanford.EDU> <DF6uIu.D8t@stdc.demon.co.uk> <43q1ko$q5s@Radon.Stanford.EDU>
Reply-To: volpe@ausable.crd.ge.com
NNTP-Posting-Host: bart.crd.ge.com