• Oh d-ai-ry d-ai-ry me

    From Richard Heathfield@21:1/5 to All on Fri May 30 21:01:50 2025
    This evening I accidentally bumped into a chatbot, and I wondered
    whether it was any good at C programming.

    I was impressed when it solved Goldbach's Conjecture (admittedly
    for small n) and 5-disc Hanoi, but then I thought back to a
    recent thread here (which I have no intent of resurrecting), so I
    asked it if it could have saved me a job if I'd only asked it a
    few hours ago.

    Judge for yourselves!

    I asked: "Write a program that is valid C90 but invalid C99."

    ChatGPT said:

    Certainly! To illustrate this, I'll write a C program that is
    valid in C90 but invalid in C99. The key difference between C90
    and C99 revolves around variable declaration and initialization.
    Key Issue:

    In C90, variables can only be declared at the beginning of a
    block (before any executable code).

    In C99, variables can be declared anywhere within a block,
    even between statements.

    C Program Example:

    This program is valid in C90 but invalid in C99 because the
    variable x is declared after executable code.

    #include <stdio.h>

    int main() {
    printf("Hello, world!\n");

    int x = 5; // Declaration after executable code (invalid in
    C99)

    printf("x = %d\n", x);
    return 0;
    }

    Why it’s Valid in C90:

    In C90, all variable declarations must appear at the
    beginning of a block (before any code). This program would be
    valid in C90 because x is declared after the printf statement,
    but only the declaration of x itself breaks the rule in C99.

    Why it’s Invalid in C99:

    In C99, variables can be declared anywhere within a block,
    even after executable statements (not just at the beginning of a
    block). This is why the above code would cause an error in C99,
    as the variable x is declared after a statement (printf).

    Compilation Example:

    If you compile this program with a C99 compiler (e.g., GCC),
    you'll get an error similar to this:

    error: variable 'x' declared after statement

    To summarize:

    C90 allows this style (declaration after code).

    C99 does not allow it, so the program becomes invalid.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Richard Heathfield on Sat May 31 13:02:48 2025
    On 30.05.2025 22:01, Richard Heathfield wrote:
    This evening I accidentally bumped into a chatbot, and I wondered
    whether it was any good at C programming.

    I was impressed when it solved Goldbach's Conjecture (admittedly for
    small n) and 5-disc Hanoi, but then I thought back to a recent thread
    here (which I have no intent of resurrecting), so I asked it if it could
    have saved me a job if I'd only asked it a few hours ago.

    Incidentally we yesterday sat together in a beer garden, and for some
    computing problem a friend asked a bot for programs ("C" and Perl) to
    a question. We got them and another friend was keen enough to test it.
    It was practically unusable for the parameters due to its algorithmic complexity and for reduced parameter sizes it just didn't work. - The impression I got from looking at the code was that the bot might have
    just picked some (maybe popular) public sources matching the question
    and reproduces those in the answer. - Are the bots really capable to
    "develop" programs?

    Janis

    Judge for yourselves!
    [...]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Heathfield@21:1/5 to Janis Papanagnou on Sat May 31 12:53:01 2025
    On 31/05/2025 12:02, Janis Papanagnou wrote:
    On 30.05.2025 22:01, Richard Heathfield wrote:
    This evening I accidentally bumped into a chatbot, and I wondered
    whether it was any good at C programming.

    I was impressed when it solved Goldbach's Conjecture (admittedly for
    small n) and 5-disc Hanoi, but then I thought back to a recent thread
    here (which I have no intent of resurrecting), so I asked it if it could
    have saved me a job if I'd only asked it a few hours ago.

    Incidentally we yesterday sat together in a beer garden, and for some computing problem a friend asked a bot for programs ("C" and Perl) to
    a question. We got them and another friend was keen enough to test it.
    It was practically unusable for the parameters due to its algorithmic complexity and for reduced parameter sizes it just didn't work. - The impression I got from looking at the code was that the bot might have
    just picked some (maybe popular) public sources matching the question
    and reproduces those in the answer. - Are the bots really capable to "develop" programs?

    Probably not, as my C90/C99 test more or less illustrated. It
    'knew' of a syntax rule, but failed to apply it correctly.

    I just tried again, this time asking for a C90 program to produce
    a frequency count of colours in a 24-bit bitmap.

    It took three laps to make it C90-legal.

    I can see how a programmer might be tempted to use AI to get a
    first draft, but you wouldn't want to bet the farm on the
    unreviewed code.

    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Tobin@21:1/5 to [email protected] on Sat May 31 19:23:28 2025
    In article <101eqj0$13q67$[email protected]>,
    Richard Heathfield <[email protected]> wrote:

    Probably not, as my C90/C99 test more or less illustrated. It
    'knew' of a syntax rule, but failed to apply it correctly.

    You have put your finger on it. LLMs do not apply knowledge.

    -- Richard

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ar Rakin@21:1/5 to Richard Heathfield on Tue Jun 3 22:06:50 2025
    On 5/31/25 2:01 AM, Richard Heathfield wrote:
    This evening I accidentally bumped into a chatbot, and I wondered
    whether it was any good at C programming.

    I was impressed when it solved Goldbach's Conjecture (admittedly for
    small n) and 5-disc Hanoi, but then I thought back to a recent thread
    here (which I have no intent of resurrecting), so I asked it if it could
    have saved me a job if I'd only asked it a few hours ago.

    Judge for yourselves!

    I asked: "Write a program that is valid C90 but invalid C99."

    ChatGPT said:

    Certainly! To illustrate this, I'll write a C program that is valid in
    C90 but invalid in C99. The key difference between C90 and C99 revolves around variable declaration and initialization.
    Key Issue:

        In C90, variables can only be declared at the beginning of a block (before any executable code).

        In C99, variables can be declared anywhere within a block, even between statements.

    C Program Example:

    This program is valid in C90 but invalid in C99 because the variable x
    is declared after executable code.

    #include <stdio.h>

    int main() {
        printf("Hello, world!\n");

        int x = 5;  // Declaration after executable code (invalid in C99)

        printf("x = %d\n", x);
        return 0;
    }

    Why it’s Valid in C90:

        In C90, all variable declarations must appear at the beginning of a block (before any code). This program would be valid in C90 because x is declared after the printf statement, but only the declaration of x
    itself breaks the rule in C99.

    Why it’s Invalid in C99:

        In C99, variables can be declared anywhere within a block, even
    after executable statements (not just at the beginning of a block). This
    is why the above code would cause an error in C99, as the variable x is declared after a statement (printf).

    Compilation Example:

    If you compile this program with a C99 compiler (e.g., GCC), you'll get
    an error similar to this:

    error: variable 'x' declared after statement

    To summarize:

        C90 allows this style (declaration after code).

        C99 does not allow it, so the program becomes invalid.


    This is the reason why I tell people who write code that AI/LLMs can't
    ever replace them like this. AI tools can only be a tool that you use.
    To write code, you'd still need to know something by yourself at the end
    of the day.

    --
    Rakin

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrew Smallshaw@21:1/5 to Richard Tobin on Wed Jun 4 12:37:17 2025
    On 2025-05-31, Richard Tobin <[email protected]> wrote:
    In article <101eqj0$13q67$[email protected]>,
    Richard Heathfield <[email protected]> wrote:

    Probably not, as my C90/C99 test more or less illustrated. It
    'knew' of a syntax rule, but failed to apply it correctly.

    You have put your finger on it. LLMs do not apply knowledge.

    It was also blissfully ignorant that C90 lacks // comments.

    --
    Andrew Smallshaw
    [email protected]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Shepelev@21:1/5 to All on Mon Jun 9 14:21:55 2025
    Richard Heathfield:

    I asked: "Write a program that is valid C90 but invalid
    C99."

    ChatGPT said:

    Certainly! To illustrate this, I'll write a C program that
    is valid in C90 but invalid in C99.

    This AI cannot speak English and answer questions as they
    are asked:

    1. You did not ask it /whether/ it were possible to write
    such a program, so its answer "Certainly" either makes
    no sense, or means agreement to fullfil your request.

    2. If it means agreement, the following sentence makes no
    sense, for what is it going to illustrate (if not the
    possiblity of such a program)?

    3. And then it cocludes with a blatant tautology,
    promising to "illustrate" the wrting of a C90-but-not-
    C99 program, by writing a C90-but-not-C99 program.

    Its diction is like that of schoolchild taught to start an
    answers by repeating the question, but not understanding how
    to do it.

    --
    () ascii ribbon campaign -- against html e-mail
    /\ www.asciiribbon.org -- against proprietary attachments

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Roberto@21:1/5 to After serious thinking Anton Shepel on Mon Jun 9 15:13:31 2025
    After serious thinking Anton Shepelev wrote :
    Richard Heathfield:

    I asked: "Write a program that is valid C90 but invalid
    C99."

    ChatGPT said:

    Certainly! To illustrate this, I'll write a C program that
    is valid in C90 but invalid in C99.

    This AI cannot speak English and answer questions as they
    are asked:

    1. You did not ask it /whether/ it were possible to write
    such a program, so its answer "Certainly" either makes
    no sense, or means agreement to fullfil your request.

    2. If it means agreement, the following sentence makes no
    sense, for what is it going to illustrate (if not the
    possiblity of such a program)?

    3. And then it cocludes with a blatant tautology,
    promising to "illustrate" the wrting of a C90-but-not-
    C99 program, by writing a C90-but-not-C99 program.

    Its diction is like that of schoolchild taught to start an
    answers by repeating the question, but not understanding how
    to do it.

    + 1

    Thanks to underlining it.

    --
    Roberto

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Roberto@21:1/5 to All on Mon Jun 9 15:17:17 2025
    Roberto submitted this idea :
    After serious thinking Anton Shepelev wrote :
    Richard Heathfield:

    I asked: "Write a program that is valid C90 but invalid
    C99."

    ChatGPT said:

    Certainly! To illustrate this, I'll write a C program that
    is valid in C90 but invalid in C99.

    This AI cannot speak English and answer questions as they
    are asked:

    1. You did not ask it /whether/ it were possible to write
    such a program, so its answer "Certainly" either makes
    no sense, or means agreement to fullfil your request.

    2. If it means agreement, the following sentence makes no
    sense, for what is it going to illustrate (if not the
    possiblity of such a program)?

    3. And then it cocludes with a blatant tautology,
    promising to "illustrate" the wrting of a C90-but-not-
    C99 program, by writing a C90-but-not-C99 program.

    Its diction is like that of schoolchild taught to start an
    answers by repeating the question, but not understanding how
    to do it.

    + 1

    Thanks to underlining it.

    Thanks _for_ underlining it.

    --
    Roberto

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)