decided to write in a file fields of a class, and restore from a file through the constructor, but the modifier const will interfere with this
the code is almost finished, in theory i can delete all const, but... But I don't want to lose an opportunity of further modification, and const is very helpful during code modifications
is it possible to use a macro to remove/delete the const modifier ? and disable it when needed ?
ZS: there is a code:
decided to write in file fields of class, and restore from file through constructor, but const modifier will interfere with this
the code is almost finished, in theory i can delete all const, but... But I don't want to lose an opportunity of further modification, and const is very helpful during code modifications
What's the idea? Everywhere c_cmd is a constant and one function is not a constant? If so, it's UB (yes μl won't allow to do so), well there because of read only segments, compiler optimizations ...
What's the idea? Is c_cmd a constant everywhere and one function is not a constant? If so, it's UB (yes μl won't allow to do so), well there because of read only segments, compiler optimizations ...
I decided to save all the fields of 2 classes with all settings and current states in them when placing a new order (multi-order TS).
I have decided to use a separate structure with fields by field names of classes to be saved - I will just copy the structure in 2 minutes in the editor))), and it is convenient to save the fields with a single call of FileWriteStruct()
and to restore state I will use this constructor for example:
in this constructor call, constant fields can be initialized
restoring of data is only needed to reload the terminal
I haven't done it yet, but I'm 99% sure it will work without problems - I didn't want to introduce a new data type (storage structure) - but it will be easier and I can read the code later....commentary is not ours to write - ))))
I decided to save all the fields of 2 classes with all settings and current states in them when placing a new order (multi-order TS).
I have decided to use a separate structure with fields by field names of classes to be saved - I will just copy the structure in 2 minutes in the editor))), and it is convenient to save the fields with a single call of FileWriteStruct()
and to restore state I will use this constructor for example:
when this constructor is called, constant fields can be initialized
restoring of data is only needed to reload the terminal
I haven't done it yet, but I'm 99% sure it will work without problems - I didn't want to introduce a new data type (storage structure) - but it will be easier and I can read the code later....comments are not ours to write - ))))
If you don't want to create a temporary structure for writing, try to write fields to the file one by one and then read them from the constructor in the same way. It's not necessarily faster, but the code will definitely look "uglier".
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
How do I remove the limit of 8 elements in the number of macro arguments, I am short of 8 elements?
A macro in a macro should be written.
Why not just write functions?
is there a way to remove/delete the const modifier with a macro ? and disable it when needed ?
ZS: there is a code:
decided to write in a file fields of a class, and restore from a file through the constructor, but the modifier const will interfere with this
the code is almost finished, in theory i can delete all const, but... But I don't want to lose an opportunity of further modification, and const is very helpful during code modifications
is it possible to use a macro to remove/delete the const modifier ? and disable it when needed ?
Hmm, that simple?!
how do I limit the section of the source code where I want to apply the macro?
how do I limit the area of the source code where I want to apply the macro?
is it possible to use a macro to remove/delete the const modifier ? and disable it when needed ?
ZS: there is a code:
decided to write in file fields of class, and restore from file through constructor, but const modifier will interfere with this
the code is almost finished, in theory i can delete all const, but... But I don't want to lose an opportunity of further modification, and const is very helpful during code modifications
What's the idea? Everywhere c_cmd is a constant and one function is not a constant? If so, it's UB (yes μl won't allow to do so), well there because of read only segments, compiler optimizations ...
Hmm, simple again.
THANK YOU!
What's the idea? Is c_cmd a constant everywhere and one function is not a constant? If so, it's UB (yes μl won't allow to do so), well there because of read only segments, compiler optimizations ...
I decided to save all the fields of 2 classes with all settings and current states in them when placing a new order (multi-order TS).
I have decided to use a separate structure with fields by field names of classes to be saved - I will just copy the structure in 2 minutes in the editor))), and it is convenient to save the fields with a single call of FileWriteStruct()
and to restore state I will use this constructor for example:
COrder::COrder(SRecovery &property) : c_cmd(property.c_cmd), c_volume(property.c_volume), c_price(property.c_price), c_magic(property.c_magic), c_stoploss(property.c_stoploss), c_takeprofit(property.c_takeprofit) { }in this constructor call, constant fields can be initialized
restoring of data is only needed to reload the terminal
I haven't done it yet, but I'm 99% sure it will work without problems - I didn't want to introduce a new data type (storage structure) - but it will be easier and I can read the code later....commentary is not ours to write - ))))
Hmm, simple again.
THANK YOU!
I decided to save all the fields of 2 classes with all settings and current states in them when placing a new order (multi-order TS).
I have decided to use a separate structure with fields by field names of classes to be saved - I will just copy the structure in 2 minutes in the editor))), and it is convenient to save the fields with a single call of FileWriteStruct()
and to restore state I will use this constructor for example:
when this constructor is called, constant fields can be initialized
restoring of data is only needed to reload the terminal
I haven't done it yet, but I'm 99% sure it will work without problems - I didn't want to introduce a new data type (storage structure) - but it will be easier and I can read the code later....comments are not ours to write - ))))