Declaring variables behind the loop or inside the loop? - page 9

 
Vict:

I don't get it, do I?

I doubt you didn't know.

It's understandable.

I'd like something like that:

.......
int tipa_var;
// бла-бла-бла
..................
// кирдык, дальше она не нужна
удаляю tipa_var
 
Сергей Таболин:

That's understandable.

I'd like something like:

Well, put the blocks in, that's what I always do.

int long_lining_var;
/*block*/ {
        int tipa_var;
        ...
} // кирдык, дальше она не нужна

Or are two brackets too many )?

 
Vict:

Well and arrange the blocks, that's what I always do.

Or are two brackets too many )?

It's not just a lot... It's like Everest on your head... )))))))))

That's what old age means - I always thought "two brackets" were supposed to open with something...

And that they can just "localize" some code - I'm not sure....

Live and learn! Praise ... me )))) - I am always glad to learn what I did not know.

And thank you! )))))))))

 
Igor Makanu:

1953-2008 father

1953-2019 father-in-law

My sympathies and condolences. I'm a year younger, or even less. So I don't need to fill up my vocabulary any more.

 
Alexey Viktorov:

My sympathies and condolences. I'm a year younger, or even less. So I don't need to fill up my vocabulary any more.

OK

it's not about vocabulary, it's about understanding that you were introduced to computing 30+ years ago and there were simple programming languages, Pascal, Basic, Fortran, Assembler and...

but the fact that now you use Windows - click the mouse - get the result or android/appletophone..... is a merit of programmers who are not sitting on old efficient languages, but are writing many and very many software solutions, thanks to OOP and other programming paradigms

New programming styles increase the speed of software development, and this is more important than performance, because it is not a fact that the new software will be in demand by the market (users), and time is ticking? - Which of the companies developing software are ready to be the developer of a single software solution for the whole history of the company? - If the market (users) accept the idea of a new software - then, and only then, does it make sense to fight for the performance of the software, even if you rewrite it in Assembler!

Developers of compilers, RAD, frameworks and other tools also adjust their products to technologies in demand, i.e. in the end thinking that OOP is something terribly slow or using short auxiliary functions is not an effective solution.... , and if I write a "linear bit of code" - it will be effective, but not actually, and most likely it will be the opposite

such a story ;)

 
Igor Makanu:

OK

it's not about vocabulary, it's about understanding that you were introduced to computing 30+ years ago and there were simple programming languages, Pascal, Basic, Fortran, Assembler and...

but the fact that now you use Windows - click the mouse - get the result or android/appletophone..... is the merit of programmers who are not sitting on old efficient languages, but are writing lots and lots of software solutions, thanks to OOP and other programming paradigms

New programming styles increase the speed of software development, and this is more important than performance, because it is not a fact that the new software will be in demand by the market (users), and time is ticking? - Which of the companies developing software are ready to be the developer of a single software solution for the whole history of the company? - If the market (users) accept the idea of a new software - then, and only then, does it make sense to fight for the performance of the software, even if you rewrite it in Assembler!

Developers of compilers, RAD, frameworks and other tools also adjust their products to technologies in demand, i.e. in the end thinking that OOP is something terribly slow or using short auxiliary functions is not an effective solution.... , and if I write a "linear bit of code" - it will be effective, but not necessarily, and most likely it will be the opposite

that's the story ;)

I agree with everything except one thing. MQL is a purely software-oriented language. So why try to squeeze something out of it that it doesn't need? There is no reason to try to process some calculations as fast as possible, if many milliseconds, and sometimes even seconds, pass from tick to tick.
 
Alexey Viktorov:
So why try to squeeze something out of him that he doesn't need? What's the use of trying to make some calculations as fast as possible, if many milliseconds, sometimes even seconds, pass from tick to tick.

Some people do their work as if on an assembly line - they get the TOR (or their idea), they do the rest - they get the TOR...

and some are always looking for a way to do the job twice as fast the next time they have free time

And some are always looking for a way to speed up execution of each code fragment and then find optimal call structure to increase performance

there's only -- everyone has their own way? ))))

 
Igor Makanu:

The human factor has an effect here, some people do their work like on an assembly line - they get their ToR, they do it - they get their ToR...

Some are constantly looking for a way to make this work twice as fast the next time they have free time

And someone is constantly looking for a way to make each code fragment faster, and then find the best structure of calls to make it faster

I think there's only -- everyone has his own way? ))))

All in all, this is a useless discussion. You waste so much time trying to figure out what the customer meant by this code that you may have to rewrite the code several times. So how fast do you need to write it? To do as you understood it and then try to find out what the client meant when applying to arbitration?

And in general, I was only talking about restraint. There's no need to overload the code in MQL, often with useless object creations.

There are many examples of uselessness, but I don't feel like discussing this topic anymore.

 
Igor Makanu:

gives out, string and print is not an indicator of variable handling

'tst.mq5' tst.mq5 1 1

possible use of uninitialized variable 'c' tst.mq5 16 10

possible use of uninitialized variable 'e' tst.mq5 20 17

code generated 1 1

0 error(s), 2 warning(s), 526 msec elapsed 1 3

Ok, it gives out when you explicitly use uninitialized in calculations. That's good.

 
Igor Makanu:

OK

it's not about vocabulary, it's about understanding that you were introduced to computing 30+ years ago and there were simple programming languages, Pascal, Basic, Fortran, Assembler and...

but the fact that now you use Windows - click the mouse - get the result or android/appletophone..... is the merit of programmers who are not sitting on old efficient languages, but are writing lots and lots of software solutions, thanks to OOP and other programming paradigms

New programming styles increase the speed of software development, and this is more important than performance, because it is not a fact that the new software will be in demand by the market (users), and time is ticking? - Which of the companies developing software are ready to be the developer of a single software solution for the whole history of the company? - If the market (users) accept the idea of a new software - then, and only then, does it make sense to fight for the performance of the software, even if you rewrite it in Assembler!

Developers of compilers, RAD, frameworks and other tools also adjust their products to technologies in demand, i.e. in the end thinking that OOP is something terribly slow or using short auxiliary functions is not an effective solution.... , and if I write a "linear bit of code" - it will be effective, but not actually, and most likely it will be the opposite

that's the story ;)

When I was hired I mostly worked in the field of embedded, dsp etc., although I can do desktop and database stuff, I don't remember it now. Well, at embedded level switching to OOP often reduces performance by half or two times. There was a lot of work with assembler, you read the generated code in asm and you see there is so much unnecessary gestures. But this is all trifles in our reality. When I buy a decent video card I will be able to write for OpenCL. I will become cool ))

Reason: