Re: pass a struct by value/ref and size of the struct

2016-04-02 Thread ZombineDev via Digitalmars-d-learn
On Saturday, 2 April 2016 at 09:28:58 UTC, ZombineDev wrote: On Wednesday, 23 March 2016 at 19:39:49 UTC, kinke wrote: On Tuesday, 22 March 2016 at 07:35:49 UTC, ZombineDev wrote: If the object is larger than the size of a register on the target machine, it is implicitly passed by ref That's

Re: pass a struct by value/ref and size of the struct

2016-04-02 Thread ZombineDev via Digitalmars-d-learn
On Wednesday, 23 March 2016 at 19:39:49 UTC, kinke wrote: On Tuesday, 22 March 2016 at 07:35:49 UTC, ZombineDev wrote: If the object is larger than the size of a register on the target machine, it is implicitly passed by ref That's incorrect. As Johan pointed out, this is somewhat true for

Re: pass a struct by value/ref and size of the struct

2016-03-23 Thread kinke via Digitalmars-d-learn
On Tuesday, 22 March 2016 at 07:35:49 UTC, ZombineDev wrote: If the object is larger than the size of a register on the target machine, it is implicitly passed by ref That's incorrect. As Johan pointed out, this is somewhat true for the Win64 ABI (but it firstly copies the argument before

Re: pass a struct by value/ref and size of the struct

2016-03-22 Thread Johan Engelen via Digitalmars-d-learn
On Tuesday, 22 March 2016 at 07:35:49 UTC, ZombineDev wrote: If the object is larger than the size of a register on the target machine, it is implicitly passed by ref (i.e. struct fields are accessed by offset from the stack pointer). (Oops, sorry ZombineDev, should've read your reply

Re: pass a struct by value/ref and size of the struct

2016-03-22 Thread Johan Engelen via Digitalmars-d-learn
On Monday, 21 March 2016 at 23:31:06 UTC, ref2401 wrote: I have got a plenty of structs in my project. Their size varies from 12 bytes to 128 bytes. Is there a rule of thumb that states which structs I pass by value and which I should pass by reference due to their size? Note that the

Re: pass a struct by value/ref and size of the struct

2016-03-22 Thread ZombineDev via Digitalmars-d-learn
On Monday, 21 March 2016 at 23:31:06 UTC, ref2401 wrote: I have got a plenty of structs in my project. Their size varies from 12 bytes to 128 bytes. Is there a rule of thumb that states which structs I pass by value and which I should pass by reference due to their size? Thanks. If the

Re: pass a struct by value/ref and size of the struct

2016-03-21 Thread tsbockman via Digitalmars-d-learn
On Monday, 21 March 2016 at 23:31:06 UTC, ref2401 wrote: I have got a plenty of structs in my project. Their size varies from 12 bytes to 128 bytes. Is there a rule of thumb that states which structs I pass by value and which I should pass by reference due to their size? Thanks. Not really.

pass a struct by value/ref and size of the struct

2016-03-21 Thread ref2401 via Digitalmars-d-learn
I have got a plenty of structs in my project. Their size varies from 12 bytes to 128 bytes. Is there a rule of thumb that states which structs I pass by value and which I should pass by reference due to their size? Thanks.