Errors, bugs, questions - page 2417

 
Alexey Navoykov:

I'm aware that it doesn't compile. I'm talking about syntax checking (which in ME is also called "Compile"), because I even specified it in brackets in a previous post. If you run syntax checking in the C++ compiler too (via the command line usually), it will swear like a darling.

See, if you don't specify:

B b;

C++ compiles this code perfectly. So the syntax is correct. The problem starts at the object creation level, because that's where class objects will be allocated.

Just imagine a template that you would never check to see if it can be used in a header. What should the compiler do in this case? Suppose you need to implement std:lower for a structure and there is no implementation in *.h.. The compiler may not swear at the check stage either.

Could you specify how you check syntax for *.h from the command line to check this code? It became interesting)

 
Andrey Pogoreltsev:

See, if you don't specify:

C++ compiles this code perfectly. Then the syntax is correct.

Interesting logic ) And if you remove all the code at all, then the syntax is even more correct? ) I cited a concrete code. I didn't say that the B class in particular is incorrect. It may well be used to call static methods, etc.

Just imagine a template that you won't check for use in the header. What should the compiler do in this case?

There's no need to substitute notions. A template is checked only when it's expanded with concrete types, it's understandable.

Could you specify how you check syntax for *.h from the command line to check this code? It got interesting)

I can't give any tips here, because I did not bother with such a tambourine, and wrote a macro for VS, which does compilation of header. For this purpose it switches current document mode to cpp on the fly, compiles it, then returns back. Simple and tasteful.

I don't understand why there's no normal option for checking header syntax in studio at all. I'm using a rather old version, maybe it's already available.

 
Alexey Navoykov:

I don't understand why there is no normal option for checking header syntax in studio at all.

Ctrl+F7 , this combination has probably been available since at least 2008 - compile a separate file
 
TheXpert:
Ctrl+F7 , this combination has probably been around since at least Studio 2008 - compile a separate file
I am talking about headers, while this combination refers to cpp. At least, it is so in my 2010 studio.
 

I hesitated for a long time before posting, double-checking my own build, but there's still something wrong with the tester...

The test literally stopped at the beginning:

Without changing anything, I press "start" a second time, goes to the end (with a small pause in the place where it interrupted) :

Made a few more approaches - results are strictly alternating (one after the other, even/odd). Up to the point of "cliff" the balance graphs are similar. Again, I don't change anything, just click "start"

This is most likely the point where it adds one more character (why not all 5 since the start of the test?):


Leaving aside the issue of actual memory availability (according to task manager, 1.2-1.4GB free, i.e. matches the report), it can't be that the same test needs different amounts of memory to run? And if the report says 400Mb is enough, you can run three such tests on 1.2Gb...

Additional data: test on 5 symbols, by bar opening, H1, 2004...today. The body has 7 double arrays with 500 elements and one small array-structure (stores data for each symbol, i.e. in this case 5 x 13), the size is set during initialization and doesn't change anymore, i.e. there's nothing to consume memory. The code is procedural, simple, small, without recursion and include libraries.

It works on four symbols, but on 6-7-8 it has the same effect as on 5 symbols - just once. At the same time first time after adding a new character - always works, the next - no, then it works again, etc.

There is a suspicion that memory is not being released in a timely manner, just the presence of an error related to lack of it.

Total of 3 problems:

  • the test runs only once (strictly) if there are no changes in settings or code
  • there is enough free memory for several tests (if the message after successful test passes can be trusted), but an error of insufficient memory appears (on even attempts). (400 were used during "success", 1200 were free when the error occurred)
  • some characters are connected in the middle of the test, if there is a history (you can see it on the sync log). Polling signal on each new bar of all symbols (in loop)

 
Alexey Navoykov:
It was about headers, and this combination refers to cpp. At least in my 2010 studio it does.
yes ( and your way seems to be more convenient than making an empty cpp for the header
 

Why is it forbidden?

void fn(const int&) {}

void start() {
   fn(5);  // parameter passed as reference, variable expected

}
 
Vict:

Why is it forbidden?

literal only by value. why - I don't know, you have to ask the development team
 
TheXpert:
This has been the tradition since time immemorial. literals by value only. why - I don't know, you have to ask the developers

Passing a parameter by reference implies that there is a variable distributed in memory.

Constants are not stored anywhere and are used directly.

 
TheXpert:
I don't know why, I'll have to ask the developers.

To please the masochists. I was not impressed with the standard bilio, so I decided to write a similar vector, but because of the abundance of "tricks", it turns out to be another underdevelopment.

void push_back(const T &value);