Errors, bugs, questions - page 715

 
Yedelkin:

Wouldn't these constants work?

Another value has been added there:

Identifier

Description

Property type

MQL5_PROGRAM_TYPE

mql5program_type

ENUM_PROGRAM_TYPE

MQL5_DLLS_ALLOWED

Permission to use the DLL for thecurrent program running

bool

MQL5_TRADE_ALLOWED

Permissionto trade for this running program

bool

MQL5_DEBUGGING

Sign of a running program working in debug mode

bool

MQL5_TESTING

Sign of running a program in the tester

bool

MQL5_OPTIMIZATION

Sign of running a program during optimization

bool

MQL5_VISUAL_MODE

Sign of running a program in a visual testing mode

bool

MQL5_LICENSE_TYPE

A license type for an EX5 module. The license refers to the EX5 module, from which a request is made using Mql5InfoInteger(MQL5_LICENSE_TYPE).

ENUM_LICENSE_TYPE

 
Rosh:

Another value has been added there:

Yes, I have the January Handbook.
 
Yedelkin:

Would these constants work?

Yes, that's it! Danke schön!
 
mql5:
Yes, you're right, it's a compiler error, we'll fix it.

Wow! // I thought you were going to make the compiler throw an error.

Thank you, if this syntax works, that would be fine.

--

Actually, thank you all very much. The language is blooming. The minor bugs and titbits, I think, are temporary.

 
void der()
{
  int app;
  for(int i=0;i<100;i++)
  {app++;}
  Print("app=",app);
}
void OnInit()
{
EventKillTimer();
EventSetTimer(1000);
}
void OnTick()
{
}
void OnTimer()
{
der();
}

On the way out

2011.07.28 19:53:20 app=2439.

2011.07.28 20:10:00 app=2139.

2011.07.28 20:26:40 app=2239.

int app; - should not automatically assign 0?

 
sion:

int app; - shouldn't it automatically assign 0?

No. You have to initialise it yourself.
 
joo:
No. You have to initialise it yourself.
It's hard for beginners when unknown numbers start coming out) But it makes sense, if the app in global variables is not a problem.
Документация по MQL5: Основы языка / Переменные / Глобальные переменные
Документация по MQL5: Основы языка / Переменные / Глобальные переменные
  • www.mql5.com
Основы языка / Переменные / Глобальные переменные - Документация по MQL5
 
sion:
It's hard for beginners when unknown digits begin to appear) But there is sense in it, if you want to output app to global variables, it seems there is no problem.

Global variables do not have to be initialised automatically either. You are probably just "lucky". Lucky in quotes, because such luck is fraught with subsequent collapse of the roof with leftist claims to developers, such as "yesterday it worked and today it doesn't. Your platform is unstable...!".

;-)

There is a sense in it - it takes time for initialization.

If the user cares about time and there is no need to initialize during declaration (the required value will be assigned at the right time anyway), then super-caring compiler may waste time on initialization for nothing. That's why it's a common practice in all serious languages - initialization is up to the programmer. Which is good and correct. Just get used to it.

Guaranteed zeros are only in the heads of beginners :) // I like meaningful ambiguities.

;)

 
Why does Print(1/2); write 0 ? Does it round to a whole number?
 
fellow:
Why does Print(1/2); write 0 ?

Because!

You should do this if you hate real numbers:

Print((double)1/(double)2);
Reason: