Jean SUZINEAU via fpc-pascal said on Mon, 5 Jun 2023 11:56:59 +0200
>Hello, I have a hard time trying to understand what you want to test.
>
>In your functions, you are using a record, not a class or a pointer to
>record or an object.
>
>The personrecord just behave in your parameters and return
Oops, I hit "Send message" too quickly.
The only difference in the second code is:
- personrecord renamed to personclass and declared as "personclass = class"
- "newp:= personclass.Create;" added in function newperson
Of course for a clean code, you'll need to call something like
Hello, I have a hard time trying to understand what you want to test.
In your functions, you are using a record, not a class or a pointer to
record or an object.
The personrecord just behave in your parameters and return value as an
Integer or a String, and your fillchar doesn't write
Travis Siegel via fpc-pascal said on Sun, 4 Jun 2023 19:38:44 +
>
>On 6/4/2023 1:37 PM, Steve Litt via fpc-pascal wrote:
>> Henry Vermaak via fpc-pascal said on Fri, 2 Jun 2023 09:38:17 +0100
>>
>>> On Fri, 2 Jun 2023 at 01:36, Steve Litt via fpc-pascal
>>> wrote:
Depending on the compiler *not* to overwrite local variables is most
certainly the wrong way to go with this. You really should create
either a global record/object, or use functions to pass around the
information you need. Expecting the operating system to keep local
variables after the
Ralf Quint via fpc-pascal said on Thu, 1 Jun 2023 17:43:58 -0700
>On 6/1/2023 5:36 PM, Steve Litt via fpc-pascal wrote:
>>
>> What is the best way for me to construct newperson() so that every
>> time called it would return a new variable?
>W.T.F.?
>
>Sorry, but for how long are you
Henry Vermaak via fpc-pascal said on Fri, 2 Jun 2023 09:38:17 +0100
>On Fri, 2 Jun 2023 at 01:36, Steve Litt via fpc-pascal
> wrote:
>> fillchar(junkvar, junkvar_size, 'b');
>> person := modperson(person, 'Martin');
>> person := modperson(person2, 'Maria');
>
>Maybe a
On Fri, 2 Jun 2023 at 01:36, Steve Litt via fpc-pascal
wrote:
> fillchar(junkvar, junkvar_size, 'b');
> person := modperson(person, 'Martin');
> person := modperson(person2, 'Maria');
Maybe a typo? (E.g. person2 := modperson(person2, 'Maria'))
Henry
On 6/1/2023 5:36 PM, Steve Litt via fpc-pascal wrote:
Hi all,
I'm trying to create a function (called newperson()) that creates a new
instance of a record. The following compiles with no errors or warnings
in FPC, but multiple calls to newperson() produce exactly the same
variable, so in the
Hi all,
I'm trying to create a function (called newperson()) that creates a new
instance of a record. The following compiles with no errors or warnings
in FPC, but multiple calls to newperson() produce exactly the same
variable, so in the preceding changing person changes person2, and vice
versa:
10 matches
Mail list logo