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


Groups > comp.lang.c > #142577

Re: C Translator

Path csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: C Translator
Date Thu, 28 Mar 2019 19:02:33 -0700
Organization None to speak of
Lines 57
Message-ID <lnk1gia152.fsf@kst-u.example.com> (permalink)
References <Dr6nE.1476625$Xct1.1108593@fx12.am4> <xfdnE.427090$0_.110498@fx19.am4>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Injection-Info reader02.eternal-september.org; posting-host="6a17da2b79334a190e865d7493c9d8e4"; logging-data="10761"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/TllIMy8WRy2/lnhOS6SDN"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)
Cancel-Lock sha1:DKsXI/dT9wk9pS+zQbMod5HbNLw= sha1:m/jpNsHc/Xf1DCLri9aEyIGnBVQ=
Xref csiph.com comp.lang.c:142577

Show key headers only | View raw


Bart <bc@freeuk.com> writes:
[...]
> Here are some weird constructs that I didn't know you could do:
>
>        switch (len & 31) {
>          do {
>            case  0: dest[pos -  1] = src[pos -  1];
>            case 31: dest[pos -  2] = src[pos -  2];
>            ....
>            case  2: dest[pos - 31] = src[pos - 31];
>            case  1: dest[pos - 32] = src[pos - 32];
>          } while ((pos -= 32) != 0);

Do a web search for "Duff's Device".

[SNIP]

> Compared to those, this is nothing:
>
>     extern fn(void) {....}

Missing return type.  Are you compiling in C90 mode, or did you just
leave it out?

> A function is marked as 'extern', but is defined here anyway. Since such 
> a definition must only be visible in one module, what is the point of 
> 'extern'?

The syntax for an function-definition permits a storage-class-specifier.
A constraint requires it to be either "extern" or "static" (6.9.1p4).

A function-definition has external linkage by default.  Adding the
"extern" keyword is redundant but harmless (like adding "auto" to a
block-scope object declaration).  Which means that you can declare it
and refer to it in another translation unit.  (With "static" you
couldn't do that.)

> (Apparently the point is that there is a macro added to the start of 
> both a function declaration AND its definition, and that macro happens 
> to include 'extern'. That no one will ever see 'extern' because it's 
> hidden, doesn't matter. This sort of goings on doesn't seem to be meant 
> for anyone to read.)

Did this inconvenience you in some way?  Did you implement your own C
compiler without paying attention to the C standard?

> Can anyone blame me for considering C a crude language little different 
> from assembly? In assembly, also, you can write chaotic code with no 
> logical structure.

I don't blame you for considering it any way you like.  I do blame you
for endlessly whining about it.

-- 
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