[CLOSED] : Compiler bug with template parameter = void* - page 14

 

Only brackets. Raccoons only. Hardcore only !!!11111

#define    cmp(D1,D2)          \
  ((t_flp(D1)||t_flp(D2))?(((D1)>=(D2))?(((D1)-(D2))>=EPS(D1)?1:0):(((D2)-(D1))>=EPS(D1)?-1:0)):(((D1)>(D2))?1:(((D1)<(D2))?-1:0)))
 
Ilya Malev:

Only brackets. Raccoons only. Hardcore only !!!11111

Only in #define the compiler does not generate the corresponding warnings, andit would be nice too

By the way, parentheses are unnecessary here.

(((D1)<(D2))?-1:0)
 

God forbid you should use parentheses in macros. You can't do without them there.

Igor Makanu:

as it will not change when porting code to other programming languages

In other languages (e.g. BASIC or Pascal) your bitwise and conditional operators are invalid, so it's a spurious problem and MQ messing with the priorities in the past is not an indicator.)

 
A100:

Only in #define the compiler does not generate the corresponding warnings, whichwould be nice, too

But first one to use it in a specific code, and it gives such a hint that it should be placed not in a place which it considers suspicious, but in a place where in the code the symbol from define is written. I think this is sort of a hint to keep your coons and not to abuse their preprocessor)

 
Ilya Malev:
By the way, do you not use spaces in your code as a matter of principle? Here 's another example. I don't know how you can make sense of such a jumble of characters if all the code is in that style.
 
Alexey Navoykov:
By the way, don't you use spaces in your code? Here 's another example. I don't know how one can understand such a heap of characters if all the code is in this style.

In defines, yes, I don't use them, because I don't consider them as code, they are just macros, they should be as compact as possible. And this example was specially chosen as the most raccoon-oriented of all the library ))

As for the example, written in 2 minutes, the indentation is there, where I wanted to show the important part - the calls del in OnStart and the rest was secondary and it's more important that the post doesn't occupy half a page, than to keep the indentation.

 
Ilya Malev:

... are just macros, they should be as compact as possible.

... It's more important that the post doesn't take up half a page than that it's indented.

I don't understand your logic and priorities )
 
A100:

Why don't you put them up yourself? I couldn't be bothered to look at your profile:

It's supposed to be like this:

You declare one thing, but you do exactly the opposite.

If even adherents of brackets don't put them themselves, that's the best proof of their uselessness

Alas, my code, which you cited as an example, was written by me long ago, 4 years ago I think.

My post was about welcoming unambiguity in arithmetic/logic expressions and brackets allow achieving it, now I generally try to write unambiguous conditions, it is easier for me, and it is impossible to make a mistake, you have cited a code fragment where I was calculating virtual orders, now I write this problem this way:

allorders = OrdersCount(all_buy,all_sell);
if(allorders==0){
   // если торговля одним ордером выставим ордер и выход
   if(MA1>MA2) { BUY();  return;}
   if(MA1<MA2) { SELL(); return;}
.......   

// или так
   if(all_buy==0){
      if(MA1>MA2) { BUY();  return;}
   }
   if(all_sell==0){
      if(MA1<MA2) { SELL();  return;}
   }

//ф-ция подсчета ордеров
int OrdersCount(int &buy_,int &sell_)
{
   buy_=0; sell_ =0;
.............   
   return(buy_+sell_);

}

I am not an adept of brackets, but I am a supporter of a single-valued algorithm, which will read the same way as a trading strategy

;)

PS: I'm not taking part in this chorus anymore, even if@fxsaber wrote that brackets help avoid mistakes, then there's nothing to discuss, because he knows how to write such compact codes, there are only two times more of these people on this forum, brevity is the sister of talent - it's about@fxsaber


Ilya Malev:

Only brackets. Only raccoons. Only hardcore !!!11111

And then I understood why Metacquotes do not give full-fledged pointers in MQL.... pictured your macros and code with passing pointers, dereferencing pointers into functions... hardcore is very mild, what's next BDSM? ))))

 
Igor Makanu:

For he is able to write such compact codes, there are only a handful of such people on this forum, brevity is the sister of talent - it's about@fxsaber

(Is brackets piled on top of brackets the sister of talent? ) Well, everyone is entitled to his/her opinion.
 
Alexey Navoykov:
(Is it the sister of talent to be full of unnecessary brackets? ) But everyone is entitled to his opinion.

they are not superfluous! they help to read the logic of how the expression is formed!

does the number of brackets affect speed? - except perhaps for typing speed, but nobody watches that.... the number of parentheses which each user in a day in the internet is a striking example ))))