Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

I am not an Economist. I am an honest man! -- Paul McCracken


computers / comp.sys.mac.system / Re: OT - ChatGPT is better than I thought.

SubjectAuthor
* OT - ChatGPT is better than I thought.Alan Browne
`* OT - ChatGPT is better than I thought.moi
 `- OT - ChatGPT is better than I thought.Alan Browne

1
OT - ChatGPT is better than I thought.

<xpXWM.57473$tnmf.24953@fx09.iad>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=17307&group=comp.sys.mac.system#17307

  copy link   Newsgroups: comp.sys.mac.apps comp.sys.mac.system
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx09.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Newsgroups: comp.sys.mac.apps,comp.sys.mac.system
Content-Language: en-US
From: bitbucket@blackhole.com (Alan Browne)
Subject: OT - ChatGPT is better than I thought.
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 58
Message-ID: <xpXWM.57473$tnmf.24953@fx09.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Sun, 15 Oct 2023 19:51:57 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Sun, 15 Oct 2023 15:51:57 -0400
X-Received-Bytes: 2366
 by: Alan Browne - Sun, 15 Oct 2023 19:51 UTC

Preamble: I suck at C and I'm proficient in Pascal.

While debugging a piece of C I got into a serious case of pointer mangling.

So, I asked ChatGPT to prepare a table comparing the two.

"please prepare a table comparing pointer data types and pointer
operands between FreePascal and C. Use FreePascal as the starting
point."

Resulted in a nicely prepared table and I quickly debugged my program
(for slow values of quickly).

But that's not it...

Then, on a whim: I asked: "
prepare a comparison of pascal record to C struc where the pascal record
has elements: a, b: word; c:array [1..10] of real; and next which is a
pointer to the record type.

And it did. And it made an error. So I said to it:
"I believe you need to first have a pointer to the MyRecord such as:
MyRecordPtr = ^MyRecord before the record and next should be of type
MyRecordPtr."

ChatGPT replied:
"You are absolutely correct, and I apologize for the oversight. In both
Pascal and C, when you have a pointer to a record or struct within the
same type definition, you should declare a type for that pointer first.
Here's the corrected comparison:"

and put out the correct form (which is - for the case requested):

type
MyRecordPtr = ^MyRecord; // Declare a pointer type
MyRecord = record
a, b: Word;
c: array[1..10] of Real;
next: MyRecordPtr; // Use the pointer type
end;

and for C:

struct MyStruct {
unsigned short a;
unsigned short b;
float c[10];
struct MyStruct* next;
};

(Nasty C letting programmers declare new types and vars on the fly ...
sigh).

--
“Markets can remain irrational longer than your can remain solvent.”
- John Maynard Keynes.

Re: OT - ChatGPT is better than I thought.

<kp3g1tFdt2dU1@mid.individual.net>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=17312&group=comp.sys.mac.system#17312

  copy link   Newsgroups: comp.sys.mac.apps comp.sys.mac.system
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: findlaybill@blueyonder.co.uk (moi)
Newsgroups: comp.sys.mac.apps,comp.sys.mac.system
Subject: Re: OT - ChatGPT is better than I thought.
Date: Mon, 16 Oct 2023 01:56:29 +0100
Lines: 62
Message-ID: <kp3g1tFdt2dU1@mid.individual.net>
References: <xpXWM.57473$tnmf.24953@fx09.iad>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net c3KGXAU0iiqkZuJJC1HC3g+qexh0mrX22Mqcxkdj34a/uGLGMw
Cancel-Lock: sha1:dJ2R08VJG1CRCRoBQ/bk14vBRT4= sha256:bzyIKWviRuyx9YKX5zX8mV+mCITcrmGDfZZhY1yzOpE=
User-Agent: Mozilla Thunderbird
Content-Language: en-GB
In-Reply-To: <xpXWM.57473$tnmf.24953@fx09.iad>
 by: moi - Mon, 16 Oct 2023 00:56 UTC

On 15/10/2023 20:51, Alan Browne wrote:
>
> Preamble: I suck at C and I'm proficient in Pascal.
>
> While debugging a piece of C I got into a serious case of pointer mangling.
>
> So, I asked ChatGPT to prepare a table comparing the two.
>
>    "please prepare a table comparing pointer data types and pointer
>     operands between FreePascal and C.  Use FreePascal as the starting
>     point."
>
> Resulted in a nicely prepared table and I quickly debugged my program
> (for slow values of quickly).
>
> But that's not it...
>
> Then, on a whim: I asked: "
> prepare a comparison of pascal record to C struc where the pascal record
> has elements:   a, b: word; c:array [1..10] of real; and next which is a
> pointer to the record type.
>
> And it did.  And it made an error.  So I said to it:
> "I believe you need to first have a pointer to the MyRecord such as:
> MyRecordPtr = ^MyRecord before the record and next should be of type
> MyRecordPtr."
>
> ChatGPT replied:
> "You are absolutely correct, and I apologize for the oversight. In both
> Pascal and C, when you have a pointer to a record or struct within the
> same type definition, you should declare a type for that pointer first.
> Here's the corrected comparison:"
>
> and put out the correct form (which is - for the case requested):
>
> type
>   MyRecordPtr = ^MyRecord;  // Declare a pointer type
>   MyRecord = record
>     a, b: Word;
>     c: array[1..10] of Real;
>     next: MyRecordPtr;  // Use the pointer type
>   end;
>
> and for C:
>
> struct MyStruct {
>   unsigned short a;
>   unsigned short b;
>   float c[10];
>   struct MyStruct* next;
> };
>
> (Nasty C letting programmers declare new types and vars on the fly ...
> sigh).
>
>
Hmmm.
Those declarations do not represent the same types.
[1..10] is not the same as [10].
--
Bill F.

Re: OT - ChatGPT is better than I thought.

<%vaXM.40149$0UVe.30433@fx17.iad>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=17316&group=comp.sys.mac.system#17316

  copy link   Newsgroups: comp.sys.mac.apps comp.sys.mac.system
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx17.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: OT - ChatGPT is better than I thought.
Content-Language: en-US
Newsgroups: comp.sys.mac.apps,comp.sys.mac.system
References: <xpXWM.57473$tnmf.24953@fx09.iad>
<kp3g1tFdt2dU1@mid.individual.net>
From: bitbucket@blackhole.com (Alan Browne)
In-Reply-To: <kp3g1tFdt2dU1@mid.individual.net>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 40
Message-ID: <%vaXM.40149$0UVe.30433@fx17.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Mon, 16 Oct 2023 13:02:51 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Mon, 16 Oct 2023 09:02:51 -0400
X-Received-Bytes: 1838
 by: Alan Browne - Mon, 16 Oct 2023 13:02 UTC

On 2023-10-15 20:56, moi wrote:
> On 15/10/2023 20:51, Alan Browne wrote:

>> and put out the correct form (which is - for the case requested):
>>
>> type
>>    MyRecordPtr = ^MyRecord;  // Declare a pointer type
>>    MyRecord = record
>>      a, b: Word;
>>      c: array[1..10] of Real;
>>      next: MyRecordPtr;  // Use the pointer type
>>    end;
>>
>> and for C:
>>
>> struct MyStruct {
>>    unsigned short a;
>>    unsigned short b;
>>    float c[10];
>>    struct MyStruct* next;
>> };
>>
>> (Nasty C letting programmers declare new types and vars on the fly ...
>> sigh).
>>
>>
> Hmmm.
> Those declarations do not represent the same types.

For Pascal "Real" is platform dependent and can be 32 or 64 bits.

> [1..10] is not the same as [10].

In C it would be 0 based, but in both you get a 10 element array of real
numbers.

--
“Markets can remain irrational longer than your can remain solvent.”
- John Maynard Keynes.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor