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


Groups > comp.lang.c > #142723

Re: C Translator

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: C Translator
Date 2019-04-01 19:13 -0700
Organization None to speak of
Message-ID <lnr2al889f.fsf@kst-u.example.com> (permalink)
References (16 earlier) <UuqoE.446198$P_2.104203@fx26.am4> <ln4l7ha26w.fsf@kst-u.example.com> <uzvoE.997630$Apg.19823@fx36.am4> <lnzhp98g15.fsf@kst-u.example.com> <xsyoE.465108$0_.172284@fx19.am4>

Show all headers | View raw


Bart <bc@freeuk.com> writes:
> On 02/04/2019 00:25, Keith Thompson wrote:
>> Bart <bc@freeuk.com> writes:
>>> That doesn't tell you anything?
>> 
>> Nothing that I didn't already know.
>
> So how do people end up writing programs that fail with all those 
> warnings when /you/ try and compile them>

I have no idea where that code (lisp.c) came from.  I can only assume
that author wrote it in a different environment, using a different
compiler, than the one I use, likely with a pre-C99 compiler on 32-bit
system.  The code appears to be non-portable and written in a very
questionable style.  I can imagine that there might have been valid
reasons to write it that way, but I'm not sufficiently interested to
look into it.

>> [...]
>> 
>>> Even if compilers allowed integer/pointer compares last century, there
>>> is no reason to still allow it now. That means having a hard error.
>> 
>> You know how to get a C compiler to treat it as a hard error.
>
> You keep saying that. But:
>
> * All C compilers are different
> * Not everyone knows how to do it
> * Not everyone is aware that that is what needs to be done.
> * Not everyone is bothered
> * Not everyone tests their code across multiple compilers
> * If a compiler is so lax, people might genuinely think that their C 
> code is fine

Yes, we both know all of this.

> There must be a reason why there is so much poor code in the first 
> place, and I think it's a combination of the above.

Quite possibly.

> And actually, you have a bit of a cheek to suggest that if I knew 
> everything there was to know about C compiler options, then somehow such 
> code would not exist.

I did not suggest any such thing.  I pointed out some problems with
the code, while wondering why you posted it.  I didn't think you
had written it.

> IT IS NOT MY FAULT because I didn't write it and I wasn't there when it 
> was compiled.

Fine, I never implied otherwise.

> This bit of code is from the Monads thread; it has a missing return value:
>
>    object seq( object p, object q ){
>    }
>
> Some C compilers will report a warning, some will say nothing, others 
> will only say something depending on options.
>
> Do you think that function would have survived like that if every C 
> compiler gave a fatal error? No. This is why there is some poor quality 
> software around.

C does not require a diagnostic for a missing return statement in a
non-void function.  (The behavior is undefined only if the caller uses
the returned value.)  This is, I think, because a lot of pre-ANSI code
used int functions as a stand-in for void functions, which didn't exist
yet, and requiring a diagnostic would break old code.

If you think I'm saying that I *like* the fact that no diagnostic is
required, I invite you to re-read the previous paragraph as many times
as it takes for you to realize that I didn't say that.

I just took a look at that article.  The seq function is never called.
I don't know what the intent was, but my guess is that both the body of
the function and any code that calls it is to be filled in later.  If
you wanted to point out a problem with the seq() function, you could
have posted in that thread.  The author might even have explained.

[...]

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

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


Thread

C Translator Bart <bc@freeuk.com> - 2019-03-28 16:16 +0000
  Re: C Translator Bart <bc@freeuk.com> - 2019-03-29 00:01 +0000
    Re: C Translator Robert Wessel <robertwessel2@yahoo.com> - 2019-03-28 20:31 -0500
    Re: C Translator Keith Thompson <kst-u@mib.org> - 2019-03-28 19:02 -0700
      Re: C Translator Bart <bc@freeuk.com> - 2019-03-29 02:34 +0000
        Re: C Translator David Brown <david.brown@hesbynett.no> - 2019-03-29 10:58 +0100
          Re: C Translator Bart <bc@freeuk.com> - 2019-03-29 12:47 +0000
            Re: C Translator David Brown <david.brown@hesbynett.no> - 2019-03-29 14:57 +0100
              Re: C Translator Bart <bc@freeuk.com> - 2019-03-29 14:57 +0000
                Re: C Translator fir <profesor.fir@gmail.com> - 2019-03-29 15:08 -0700
                Re: C Translator fir <profesor.fir@gmail.com> - 2019-03-29 15:42 -0700
              Re: C Translator scott@slp53.sl.home (Scott Lurndal) - 2019-03-29 15:16 +0000
                Re: C Translator Bart <bc@freeuk.com> - 2019-03-29 15:30 +0000
                Re: C Translator fir <profesor.fir@gmail.com> - 2019-03-29 14:47 -0700
        Re: C Translator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-03-29 10:42 +0000
          Re: C Translator Bart <bc@freeuk.com> - 2019-03-29 11:57 +0000
            Re: C Translator Bart <bc@freeuk.com> - 2019-03-29 13:04 +0000
            Re: C Translator David Brown <david.brown@hesbynett.no> - 2019-03-29 14:58 +0100
              Re: C Translator Bart <bc@freeuk.com> - 2019-03-29 14:29 +0000
                Re: C Translator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-03-29 20:06 +0000
            Re: C Translator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-03-29 20:02 +0000
              Re: C Translator Bart <bc@freeuk.com> - 2019-03-29 21:10 +0000
                Re: C Translator nobody@example.org (Scott) - 2019-03-30 04:52 +0000
                Re: C Translator Bart <bc@freeuk.com> - 2019-03-30 11:03 +0000
                Re: C Translator nobody@example.org (Scott) - 2019-03-30 16:17 +0000
                Re: C Translator Bart <bc@freeuk.com> - 2019-03-30 18:36 +0000
                Re: C Translator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-03-30 20:32 +0000
                Re: C Translator Bart <bc@freeuk.com> - 2019-03-30 22:44 +0000
                Re: C Translator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-03-31 03:23 +0100
                Re: C Translator Bart <bc@freeuk.com> - 2019-03-31 12:39 +0100
                Re: C Translator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-03-31 15:07 +0100
                Re: C Translator Bart <bc@freeuk.com> - 2019-03-31 16:21 +0100
                Re: C Translator David Brown <david.brown@hesbynett.no> - 2019-03-31 21:19 +0200
                Re: C Translator Bart <bc@freeuk.com> - 2019-03-31 20:58 +0100
                Re: C Translator Ike Naar <ike@iceland.freeshell.org> - 2019-03-31 20:33 +0000
                Re: C Translator Bart <bc@freeuk.com> - 2019-03-31 22:06 +0100
                Re: C Translator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-03-31 22:37 +0100
                Re: C Translator Bart <bc@freeuk.com> - 2019-03-31 23:33 +0100
                Re: C Translator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-04-01 02:35 +0100
                Re: C Translator David Brown <david.brown@hesbynett.no> - 2019-04-01 11:33 +0200
                Re: C Translator David Brown <david.brown@hesbynett.no> - 2019-03-31 23:54 +0200
                Re: C Translator Bart <bc@freeuk.com> - 2019-04-01 02:16 +0100
                Re: C Translator Ike Naar <ike@iceland.freeshell.org> - 2019-04-01 06:42 +0000
                Re: C Translator David Brown <david.brown@hesbynett.no> - 2019-04-01 11:35 +0200
                Re: C Translator Bart <bc@freeuk.com> - 2019-04-01 16:54 +0100
                Re: C Translator Bart <bc@freeuk.com> - 2019-04-01 21:01 +0100
                Re: C Translator Keith Thompson <kst-u@mib.org> - 2019-04-01 13:41 -0700
                Re: C Translator Bart <bc@freeuk.com> - 2019-04-01 22:40 +0100
                Re: C Translator Keith Thompson <kst-u@mib.org> - 2019-04-01 16:25 -0700
                Re: C Translator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-04-02 00:50 +0100
                Re: C Translator Keith Thompson <kst-u@mib.org> - 2019-04-01 17:45 -0700
                Re: C Translator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-04-02 11:28 +0100
                Re: C Translator David Brown <david.brown@hesbynett.no> - 2019-04-02 13:18 +0200
                Re: C Translator Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-04-02 19:15 +0000
                Re: C Translator Bart <bc@freeuk.com> - 2019-04-02 21:14 +0100
                Re: C Translator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-04-02 13:28 +0100
                Re: C Translator David Brown <david.brown@hesbynett.no> - 2019-04-02 10:49 +0200
                Re: C Translator Bart <bc@freeuk.com> - 2019-04-02 01:58 +0100
                Re: C Translator Keith Thompson <kst-u@mib.org> - 2019-04-01 19:13 -0700
                Re: C Translator Bart <bc@freeuk.com> - 2019-04-02 11:13 +0100
                Re: C Translator David Brown <david.brown@hesbynett.no> - 2019-04-02 13:49 +0200
                Re: C Translator Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-04-02 05:15 -0700
                Re: C Translator Bart <bc@freeuk.com> - 2019-04-02 14:50 +0100
                Re: C Translator David Brown <david.brown@hesbynett.no> - 2019-04-02 16:06 +0200
                Re: C Translator David Brown <david.brown@hesbynett.no> - 2019-04-02 16:05 +0200
                Re: C Translator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-04-02 00:11 +0100
                Re: C Translator David Brown <david.brown@hesbynett.no> - 2019-04-02 10:35 +0200
                Re: C Translator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-04-02 00:06 +0100
                Re: C Translator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-03-31 21:36 +0100
                Re: C Translator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-03-31 16:32 +0100
              Re: C Translator Bart <bc@freeuk.com> - 2019-03-30 00:37 +0000
                Re: C Translator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-03-30 01:00 +0000
                Re: C Translator fir <profesor.fir@gmail.com> - 2019-03-30 03:37 -0700
                Re: C Translator fir <profesor.fir@gmail.com> - 2019-03-30 06:15 -0700
        Re: C Translator James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-03-29 07:49 -0700

csiph-web