Home Are const record arguments put on the stack?
Reply: 0

Are const record arguments put on the stack?

user908
1#
user908 Published in April 26, 2018, 5:15 pm

Suppose I have a record type called TSomeRec:

type
  TSomeRec = record
    // ...
  end;

... and a procedure that takes a const TSomeRec argument:

procedure SomeProc(const someRec: TSomeRec);
begin
  // ...
end;

When SomeProc is called, will the const someRec argument be passed on the stack as a value or as a reference?

The reason I ask is that in the code I am working on, the record type in question contains a massive static array and so is huge. (No, I cannot change that.) I am nervous about putting such a large record on the stack, and I thought that const might help. I have had problems with this code with overflowing the stack, and when that happens, I just get mysterious access violations rather than any sort of stack overflow error.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.303437 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO