1
General / Re: many function arguments
« on: October 14, 2016, 06:40:02 pm »How is this related to SFML?
im sorry youre right.it wont happen again.
its depends on the compiler and the processor.
x86 have 4 register: EAX EBX ECX EDX (32 bits registers), a compiler can push directly parameters to the stack.push [constant]|[register]|[memory adress]
push [constant]|[register]|[memory adress]
call _myFunctionName
Often the values pushed are not constant so the compiler needs to use the 4 32-bits registers.
If your function have a lot of arguments the compiler needs to move some data between register.
But if yuro processor supports and your compiler use SIMD extensions you can have 4 more 32-bits register (XMM registers).
If you have 8 arguments better you pack few in structs or something.
But don't worry how many arguments you are passing, it is unprobable that you notice the performance hit if any.
But 8 arguments are kinda ugly in my opinion.
And for those questions go to a general C++ forum.
This forum is to discuss about SFML related things.
okay thank you for your advice!
yes i found it ugly too... thats a good idea with structs i never used it anyway...
thank you for that!:)