
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
this is called "loop unrolling" and is done by the compiler without any OO and templates (at least it should be).
If you look into the intermediate code (assembler), there are just consecutive N operations instead of a loop.
And can you tell us what happens when a function is called recursively?
Can you tell me what happens when a function is called recursively?
there's no recursive call to the target functions :-)
In the given above example N:=const, the recursion occurs only when code is generated from a template and that one is tailored. At the link, a clever twist is to collapse the const-cycle into template recursion and call it a clever word
if macros had loops it would be written like this
#for x=0, x<N, x++
print("x=%d",x);
#endfor
and after the macro processor it would unfold into a sequence of N prints. (which actually happened, only through template classes)
That is, the trick works only if N is known at compile time
and there is no recursive call to the target functions :-)
In the example given at the link N:=const, recursion is only at code generation from a template and that one is tail. At the link, a clever twist is to collapse the const-cycle into template recursion and call it a clever word
if macros had loops it would be written like this
#for x=0, x<N, x++
print("x=%d",x);
#endfor
and after the macro processor it would unfold into a sequence of N princes. (which actually happened, only through template classes)
So the trick works only if N is known at compile time
You won't believe it, but I know how templates work and what N there is, and what the result is. And my question about recursive function call was exactly about recursive function call, not about how there?
You won't believe it, but I know how templates work and what the N is and what the result is. And my question about recursive function call was exactly about recursive function call, not about how there?
is it like a "dare?" exam? :-) I somehow thought that this example was being discussed... I was wrong :-)
If the compiler can convert the recursion into a tail (or it is explicitly such, or he was told to), then physically there will be no recursion - it will make a loop (switch back) and each iteration will "trample" the previous stack frame.
is this some kind of a "dare" exam? :-) I somehow thought that this example was being discussed...I was wrong :-)
If the compiler can convert the recursion into a tail recursion (or it is explicitly such or has been told to do so), then physically there will be no recursion - it will make a loop (switch back) and each iteration will "trample" the previous stack frame.
What does this have to do with weakness? Just a question. Well, no, so no.
I don't even want to bother. I made simple structures.
For what reason access to the first field of a simple structure depends on its size - I don't understand.
Huh. It's trivial - the number of bits for multiplication is more)))) Make sure that the number of bits in the binary representation of the size of the structure was the same))) Stupidly processor, as well as a man, longer to multiply 1111*101 than 1111*10)
I won't check, there are plenty of other tasks. But I find it hard to believe.
In ME, I work with mqh, press ALT+N - the tree view in the Navigator window shows the location of the file.
Now I want to make an incluate it into an open mq5-file. I drag mqh from tree to mq5, but no appropriate include line is generated.
I won't check, there are plenty of other tasks. But I find it hard to believe.
It's for a small structure.
This is for a large one.
VS2019, Debug x64, in the release it inlined them, but the speed is the same.
The only difference is in the imul instructions, the third operand, in two places. The instruction is just that, calculating the offset in the array, and the third operand isthe size of the structure in bytes.
So, no mysticism - laws of physics in action.
So, no mysticism - the laws of physics are in action.
if you write such classes:
judging by your research, class B will be slower to execute if you use structure fields frequently in calculations?