standard constants with more than 31 length

 
Hello
Help: MQL4 Reference - Standard constants - Error codes has names which are >31chars long.
For example the compiler throws error:
'ERR_GLOBAL_VARIABLES_PROCESSING_ERROR' - too long variable name C:\Program Files\MetaTrader 4\experts\...
Is easy to work around this issue using inline hard coded constant values.
However, identifiers remove software from relying on constant values which MetaQuotes could alter at any time...
Answers appreciated.
Regards
ukt
 
Help: MQL4 Reference - Standard constants - Error codes has names which are >31chars long.
Is easy to work around this issue using inline hard coded constant values.
However, identifiers remove software from relying on constant values which MetaQuotes could alter at any time...
Why not using shorter constant names (less than 31 chars)?
No need to go extreme as using hardcoded constant values.
(For my practical purposes, 31 characters for constant names is really long).
 
fireflies:
Why not using shorter constant names (less than 31 chars)?
No need to go extreme as using hardcoded constant values.
(For my practical purposes, 31 characters for constant names is really long).
fireflies: Many thanks for your answer but I not understand your point.
I understand your comment about not using hardcoded constant values - which is generally speaking not good idea - maintenance can become nightmare - lol
I write way too much below but trying to say what is bugging me - thanks for your patience!
Maybe I'm missing something [very possible ;-)] here but as I currently understand it,
I cannot use shorter constant names without defining with the actual MQL constant value and [if/when] MetaQuotes change the constant value associated with one or more >31 char constants names, my code will no longer reflect these updated constant values, yes?
eg:
MQL lists this line in error codes table:
ERR_GLOBAL_VARIABLES_PROCESSING_ERROR 4057 Global variables processing error.
If I do this in my .mq4 or .mgh source:
#define GVAR_PROCESSING_ERROR 4057
Now, if/when they decide to change 4057 to 4067 (as an example), then my code that uses GVAR_PROCESSING_ERROR is now broken, yes?
So again, I do not see how I can use shorter names because to do so I must associate MQs long name constant value to my #define'd shorter name and it's this constant value which could possibly change.
So ok, I can have my own globalDefines.mqh for instance which I #include as required and in this include file I [effectively] redefine the long named constants to my own shorter named constants and associate the currently documented constant values with them... etc.
But I just end up with broken code if they ever change the documented constant values associated with these long names.
For sure I am probably making a big deal about nothing because it's only my code and not [yet!] mission critical - but in the end, constantless code, code that uses meaningful identifier names is what I strive for because I still get the sweats when I remember [attempting to] maintain projects with hundreds of thousands of source code lines spread over hundreds of source modules... all of course having numerous hard coded constants and worse still when there is not one line of documentation on paper or in the source code which gives any clue as to just WHY the [so-called] superprogrammer originally decided to use the constant.
Hahaaa, I vividly remember these types - sure they could code an OS in their lunch break... but us poor mere mortals who had to maintain the code after the [hahaaa]superprogrammer disappeared for next contract [like if I did not maintain then I get fired!!!] - man... total freaky times they were!
So yeah, I'm what you might say totally paranoid when coding these days - LOL, and [of course] I still manage to screw up all the time anyway!!!
Please do put me right if I not understand what you are telling me, OK?
Regards
ukt
 
My apology for not realizing your problem earlier.
I completely agree with you. It's metacompiler bug for allowing a #define'd names to have more than 31 chars, rendering the constants useless.
 
Thank You for your remarks. Will be fixed ASAP
 
fireflies 2007.06.20 16:56
My apology for not realizing your problem earlier.
I completely agree with you. It's metacompiler bug for allowing a #define'd names to have more than 31 chars, rendering the constants useless.
fireflies - Bug/inconsistency... I have not confidence to proclaim/state as such - not want flames or bad words. For me, MT is simply great platform because MetaQuotes provides good package overall - allowing novice and experienced traders alike, the opportunity to compose code for trading and also [for me] the general satisfaction of coding :-) Catch you later fireflies!
stringo:
Thank You for your remarks. Will be fixed ASAP.
Stringo - Your reply most welcomed, thank you kindly.
Look forwards to next update!
Regards to you both...
ukt
Reason: