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


Groups > comp.lang.c > #381311

Re: bart cc32n.c

From Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups comp.lang.c
Subject Re: bart cc32n.c
Date 2024-01-30 22:56 -0800
Organization A noiseless patient Spider
Message-ID <86a5omat4q.fsf@linuxsc.com> (permalink)
References (6 earlier) <up52g3$3qru0$1@dont-email.me> <86v87bbqke.fsf@linuxsc.com> <up9k5m$mkt1$1@dont-email.me> <86mssnbadi.fsf@linuxsc.com> <upammh$vegh$1@dont-email.me>

Show all headers | View raw


bart <bc@freeuk.com> writes:

> On 30/01/2024 06:31, Tim Rentsch wrote:

[...]

>> I'm not telling anyone how to compile their programs.  All I'm
>> doing is giving a way of checking whether a program is C code or
>> is written in a language that may look like C but isn't.  Knowing
>> how to do that is something I could have benefited from - many
>> years ago I wrote some code that I thought was being written in
>> C, but later I discovered that it wasn't.  I started programming
>> in C long before there was a C standard, and didn't realize the
>> degree to which different compilers had different ideas of what
>> "C" was.  As of this year we are celebrating the 35th anniversary
>> of the original C standard, and the 25th anniversary of C99, so I
>> think it's reasonable to expect that people participating in the
>> newsgroup here at least know how to tell if some code they are
>> working on is written in C or it isn't.
>
> This program was machine generated.  The way that is done now is a
> little different (for example it doesn't use standard C headers).
>
> If I apply -std=c11 -pedantic-errors, it fails on only 3 kinds of
> error:
>
> * String literals longer than 4095 characters
>
> * Initialising a void* value with the address of function
>
> * Casting an object pointer to a function pointer

If the .c file is program generated, it should be easy to fix.
So fix it.

(1) Presumably the generator knows which pointers are function
pointers and which are not.  Use a generic function type for
storing function pointers rather than trying to force everything
through void*.

(2) Rather than use long string literals, store and initialize
the variables involved (it looks like there are only two) as
character arrays.  It looks ugly but hey it's program generated
code anyway.  I tried writing a simple convertor using awk and it
took maybe 10 or 15 minutes.

Speaking of program generated source, C code that is program
generated is definitely a second class citizen as far as the
newsgroup is concerned.  It's like saying a .o file is written in
assembly.  It isn't.  Generated C source may clear the hurdle of
being compilable but they can't usefully be worked on in that
form and are generally incomprehensible to humans.  It's fair
game to ask about how to make generated source be legal C, but
describing programs like this as "written in C" is hokum.  Such
programs are useless as C code in any practical sense of the term
and thus are not suitable for discussion in comp.lang.c.

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


Thread

bart cc32n.c Paul Edwards <mutazilah@gmail.com> - 2024-01-26 18:16 +0800
  Re: bart cc32n.c Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-01-26 11:53 +0100
    Re: bart cc32n.c Paul Edwards <mutazilah@gmail.com> - 2024-01-26 18:57 +0800
      Re: bart cc32n.c bart <bc@freeuk.com> - 2024-01-26 11:08 +0000
        Re: bart cc32n.c scott@slp53.sl.home (Scott Lurndal) - 2024-01-26 15:36 +0000
          Re: bart cc32n.c bart <bc@freeuk.com> - 2024-01-26 15:49 +0000
      Re: bart cc32n.c David Brown <david.brown@hesbynett.no> - 2024-01-26 17:33 +0100
        Re: bart cc32n.c Kaz Kylheku <433-929-6894@kylheku.com> - 2024-01-26 17:13 +0000
        Re: bart cc32n.c bart <bc@freeuk.com> - 2024-01-26 18:00 +0000
          Re: bart cc32n.c David Brown <david.brown@hesbynett.no> - 2024-01-26 20:35 +0100
            Re: bart cc32n.c Paul Edwards <mutazilah@gmail.com> - 2024-01-28 15:13 +0800
              Re: bart cc32n.c David Brown <david.brown@hesbynett.no> - 2024-01-28 13:11 +0100
                Re: bart cc32n.c bart <bc@freeuk.com> - 2024-01-28 13:32 +0000
                Re: bart cc32n.c David Brown <david.brown@hesbynett.no> - 2024-01-28 15:11 +0100
                Re: bart cc32n.c Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-01-28 19:24 +0100
                Re: bart cc32n.c gazelle@shell.xmission.com (Kenny McCormack) - 2024-01-28 14:41 +0000
                Re: bart cc32n.c bart <bc@freeuk.com> - 2024-01-28 16:04 +0000
                Re: bart cc32n.c Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2024-01-28 16:15 +0000
                Re: bart cc32n.c David Brown <david.brown@hesbynett.no> - 2024-01-28 19:19 +0100
                Re: bart cc32n.c Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-01-28 19:29 +0100
                Re: bart cc32n.c Kaz Kylheku <433-929-6894@kylheku.com> - 2024-01-28 18:27 +0000
                Re: bart cc32n.c bart <bc@freeuk.com> - 2024-01-28 19:18 +0000
          Re: bart cc32n.c John McCue <jmccue@neutron.jmcunx.com> - 2024-01-26 20:55 +0000
        Re: bart cc32n.c Paul Edwards <mutazilah@gmail.com> - 2024-01-27 21:24 +0800
          Re: bart cc32n.c David Brown <david.brown@hesbynett.no> - 2024-01-27 18:36 +0100
            Re: bart cc32n.c bart <bc@freeuk.com> - 2024-01-27 17:58 +0000
              Re: bart cc32n.c Kaz Kylheku <433-929-6894@kylheku.com> - 2024-01-27 19:57 +0000
                Re: bart cc32n.c bart <bc@freeuk.com> - 2024-01-27 20:39 +0000
            Re: bart cc32n.c Paul Edwards <mutazilah@gmail.com> - 2024-01-28 16:15 +0800
              Re: bart cc32n.c David Brown <david.brown@hesbynett.no> - 2024-01-28 14:05 +0100
                Re: bart cc32n.c bart <bc@freeuk.com> - 2024-01-28 14:02 +0000
                Re: bart cc32n.c David Brown <david.brown@hesbynett.no> - 2024-01-28 17:01 +0100
                Re: bart cc32n.c bart <bc@freeuk.com> - 2024-01-28 18:34 +0000
                Re: bart cc32n.c Kaz Kylheku <433-929-6894@kylheku.com> - 2024-01-28 18:41 +0000
                Re: bart cc32n.c David Brown <david.brown@hesbynett.no> - 2024-01-28 20:10 +0100
                [meta] Re: bart cc32n.c Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-01-29 06:38 +0100
                Re: [meta] Re: bart cc32n.c bart <bc@freeuk.com> - 2024-01-29 11:58 +0000
                Re: [meta] Re: bart cc32n.c David Brown <david.brown@hesbynett.no> - 2024-01-29 14:19 +0100
                Re: bart cc32n.c Paul Edwards <mutazilah@gmail.com> - 2024-01-29 08:59 +0800
                Re: bart cc32n.c David Brown <david.brown@hesbynett.no> - 2024-01-29 14:45 +0100
                Re: bart cc32n.c Paul Edwards <mutazilah@gmail.com> - 2024-01-29 08:35 +0800
                Re: bart cc32n.c David Brown <david.brown@hesbynett.no> - 2024-01-29 16:42 +0100
              Re: bart cc32n.c Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-01-29 16:41 -0800
                Re: bart cc32n.c bart <bc@freeuk.com> - 2024-01-30 01:42 +0000
                Re: bart cc32n.c Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2024-01-30 04:40 +0000
                Re: bart cc32n.c Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-01-29 22:31 -0800
                Re: bart cc32n.c bart <bc@freeuk.com> - 2024-01-30 11:31 +0000
                Re: bart cc32n.c Kaz Kylheku <433-929-6894@kylheku.com> - 2024-01-30 20:33 +0000
                Re: bart cc32n.c Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-01-30 22:56 -0800
                Re: bart cc32n.c gazelle@shell.xmission.com (Kenny McCormack) - 2024-01-31 08:58 +0000
                Re: bart cc32n.c Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-02-01 05:28 -0800
              Re: bart cc32n.c Kaz Kylheku <433-929-6894@kylheku.com> - 2024-01-30 01:20 +0000
                Re: bart cc32n.c gazelle@shell.xmission.com (Kenny McCormack) - 2024-01-30 01:28 +0000
                Re: bart cc32n.c David Brown <david.brown@hesbynett.no> - 2024-01-30 09:26 +0100
      Re: bart cc32n.c Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-01-26 21:42 +0100
        Re: bart cc32n.c Paul Edwards <mutazilah@gmail.com> - 2024-01-27 21:36 +0800
  Re: bart cc32n.c bart <bc@freeuk.com> - 2024-01-26 11:04 +0000
    Re: bart cc32n.c Paul Edwards <mutazilah@gmail.com> - 2024-01-26 19:14 +0800
    Re: bart cc32n.c Paul Edwards <mutazilah@gmail.com> - 2024-01-26 19:38 +0800
      Re: bart cc32n.c Paul Edwards <mutazilah@gmail.com> - 2024-01-26 19:46 +0800
        Re: bart cc32n.c Paul Edwards <mutazilah@gmail.com> - 2024-01-26 19:55 +0800
    Re: bart cc32n.c bart <bc@freeuk.com> - 2024-01-26 13:51 +0000
      Re: bart cc32n.c bart <bc@freeuk.com> - 2024-01-26 18:53 +0000
        Re: bart cc32n.c Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-01-26 12:47 -0800
          Re: bart cc32n.c Paul Edwards <mutazilah@gmail.com> - 2024-01-27 07:54 +0800

csiph-web