Errors, bugs, questions - page 2502
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
Couldn't quite figure it out yet.
Not from the order of the fields, but from the maximum and set value of pack() plus it depends on the order of the fields.
Now I have made the following variant
It aligns not to 16 as specified in pack(), but to 8 by the maximal double.
plus it depends on the sequence of the fields.
checked, it does depend:
Your example gavesizeof(A) = 24So that's how this discussion started. It turns out that it's not like that at all.
Yes, I made a mistake in describing the alignment algorithm and thus may have caused even more confusion.
So,
pack is a compatibility mechanism with external dlls. In particular, it is analog of c++ #pragma pack and therefore should work in the same way.
further examples with dimensions (for pack 4)
char -> 1
short -> 2
int -> 4
long -> 8
char, short -> 4
char, int -> 8
char, long -> 12 (16 for pack(8))
short, char -> 4
long, char -> 12
long, char, short -> 12
long, char, char, char -> 12
long, char, int -> 16
long, char, int, char -> 20
studio (and probably everywhere else) defaults to pack(8)Thank you, I see.
Everything works in my opinion. Since in your example there is only one type in the structure, there is no point in alignment.
You are mistaken, it does not work correctly. It does make sense. It's a bug. https://www.mql5.com/ru/forum/1111/page2498#comment_12349659
Hello. Can you please tell me if there are any hotkeys for trading in MT5? I have not found them in the manual. If not, is there any way to implement it? I.e. I pressed a key and an order opened, is there something similar?
Wrong, it doesn't work right. It makes sense. It's a bug. https://www.mql5.com/ru/forum/1111/page2498#comment_12349659
So what's the bug?
You declare an array of two elements with two bytes each and get 4 bytes as it should be. Where's the bug? What?
This.
The array is aligned to 4 and 2 elements will take 2*8 bytes.
Hello. Can you please tell me if there are any hotkeys for trading in MT5? I have not found them in the manual. If not, is there any way to implement it? I.e., I pressed a key and an order opened, is there something similar?
Did the cat step on the keyboard and trade for you?
Do it yourself - it's not difficult.
Hello. Can you please tell me if there are any hotkeys for trading in MT5? I have not found them in the manual. If not, is there any way to implement it? I.e. I pressed a key and an order opened, is there something similar?
Terminal Help:Hotkeys - Advanced Users - Getting Started
If you need to take action "Just click once and a position is opened" - then a combination of keys should be assigned to a script or an Expert Advisor in the terminal (script or Expert Advisor should either be downloaded, written or ordered).
Has the cat stepped on the keyboard and made a trade for you?
Do it yourself - it's not hard.