<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=413012&amp;view=findpost&amp;p=3772237</guid>
        <pubDate>Sat, 16 Jun 2018 14:20:43 +0000</pubDate>
        <title>Добавление переменной в хедер приводит к ошибке</title>
        <link>https://forum.sources.ru/index.php?showtopic=413012&amp;view=findpost&amp;p=3772237</link>
        <description><![CDATA[Bas: Возможно дело в последовательности вызовов класса где определенна переменная? <br>
<div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=413012&view=findpost&p=3772053'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>secondd &#064; <time class="tag-quote__quoted-time" datetime="2018-06-14T12:32:36+03:00">14.06.18, 09:32</time></span><div class='quote '>Вот пример остановки после присвоения значения, Step содержит 1, хотя конструктор присваивает 100, а из Edit идет 20.</div></div><br>
Это не показатель, там может быть любой &quot;мусор&quot;.]]></description>
        <author>Bas</author>
        <category>Borland C++ Builder/Turbo C++ Explorer</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=413012&amp;view=findpost&amp;p=3772177</guid>
        <pubDate>Fri, 15 Jun 2018 11:39:40 +0000</pubDate>
        <title>Добавление переменной в хедер приводит к ошибке</title>
        <link>https://forum.sources.ru/index.php?showtopic=413012&amp;view=findpost&amp;p=3772177</link>
        <description><![CDATA[PMT_Dimas: Возможно дело в выравнивании]]></description>
        <author>PMT_Dimas</author>
        <category>Borland C++ Builder/Turbo C++ Explorer</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=413012&amp;view=findpost&amp;p=3772053</guid>
        <pubDate>Thu, 14 Jun 2018 09:32:36 +0000</pubDate>
        <title>Добавление переменной в хедер приводит к ошибке</title>
        <link>https://forum.sources.ru/index.php?showtopic=413012&amp;view=findpost&amp;p=3772053</link>
        <description><![CDATA[secondd: Добрый день, весь код довольно длинный и использует сторонний компонент teechart. Пытался локализовать проблему дабы уменьшить код, но не тут то было, ошибка появляется/пропадает в ответ на совершенно разные изменения кода, точнее уже не ошибка а проблема инициализации переменных класса.<br>
<br>
Например, есть Unit1 и есть класс TSysRgrss, в хедере класса объявлены переменные, в конструкторе инициализация некоторых из них. При создании его экземпляра (одинаково для статич/динамич) в Unit1 public переменным присваиваются значения. Так вот при добавлении новых переменных в хедер класса или при комменте/раскомменте частей кода в разных местах проекта получаю непредсказуемые данные в переменных. Так для Step может быть 100 из конструктора, 20 от позднего присвоения или что угодно другое.<br>
<br>
Вот пример остановки после присвоения значения, Step содержит 1, хотя конструктор присваивает 100, а из Edit идет 20.<br>
<a class='tag-url' href='http://imagehost.cc/image/Z5ZKF' target='_blank'>http://imagehost.cc/image/Z5ZKF</a><br>
<br>
Edit содержит 20.<br>
<a class='tag-url' href='http://imagehost.cc/image/Z5y6f' target='_blank'>http://imagehost.cc/image/Z5y6f</a> <br>
<br>
<span class="tag-color tag-color-named" data-value="mergepost" style="color: mergepost"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2018-06-14T09:48:09+00:00">14.06.18, 09:48</time></span></span><br>
Хедер класса выглядит так<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">#ifndef TSysRgrssH</div><div class="code_line">#define TSysRgrssH</div><div class="code_line">#include &#60;Classes.hpp&#62;</div><div class="code_line">#include &quot;Unit1.h&quot;</div><div class="code_line">//---------------------------------------------------------------------------</div><div class="code_line">class TSysRgrss {</div><div class="code_line">private:</div><div class="code_line">&nbsp;&nbsp; &nbsp;bool Data;</div><div class="code_line">&nbsp;&nbsp; &nbsp;bool Trade;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;int StepCounter;</div><div class="code_line">&nbsp;&nbsp; &nbsp;double LastPrice;</div><div class="code_line">&nbsp;&nbsp; &nbsp;int jump;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;//double FcstAim;</div><div class="code_line">&nbsp;&nbsp; &nbsp;//double FcstDrdn;</div><div class="code_line">&nbsp;&nbsp; &nbsp;//bool FcstUp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;//double y[40000]; int n;</div><div class="code_line">&nbsp;&nbsp; &nbsp;//double y2[40000];</div><div class="code_line">&nbsp;&nbsp; &nbsp;//double y3[40000]; int z3; int n3;</div><div class="code_line">&nbsp;&nbsp; &nbsp;//double y4[1000]; int n4;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;struct logic {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;bool opbuy;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;bool opsell;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;bool clbuy;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;bool clsell;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int opdev;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int cldev;</div><div class="code_line">&nbsp;&nbsp; &nbsp;} LnLogic[3][3][3];</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; struct DiapArr {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int Points;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int MainCalcPnt;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double a;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double b;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double stdev;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double m;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int trend;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bool broken;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bool ok;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bool hitmid;</div><div class="code_line">&nbsp;&nbsp; &nbsp; } Diap1;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; int PrevLength;</div><div class="code_line">&nbsp;&nbsp; &nbsp; bool BuyGranted;</div><div class="code_line">&nbsp;&nbsp; &nbsp; bool SellGranted;</div><div class="code_line">&nbsp;&nbsp; &nbsp; double OpenDev;</div><div class="code_line">&nbsp;&nbsp; &nbsp; double CloseDev;</div><div class="code_line">&nbsp;&nbsp; &nbsp; double Lastbx;</div><div class="code_line">&nbsp;&nbsp; &nbsp; double LastChange;</div><div class="code_line">&nbsp;&nbsp; &nbsp; int lstdrctn;</div><div class="code_line">&nbsp;&nbsp; &nbsp; int lstchng;</div><div class="code_line">&nbsp;&nbsp; &nbsp; int lstaclr;</div><div class="code_line">&nbsp;&nbsp; &nbsp; int PrevLastPivot;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; int lstchng2;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; //---------------------------------------------------------------------------</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; struct PtArr {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int n;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bool lasthi;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double pr[20];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int tick[20];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //TDateTime dt[20];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double disp[20];</div><div class="code_line">&nbsp;&nbsp; &nbsp; } HL;</div><div class="code_line">&nbsp;&nbsp; &nbsp;//---------------------------------------------------------------------------</div><div class="code_line">&nbsp;</div><div class="code_line">public:</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;__fastcall TSysRgrss();</div><div class="code_line">&nbsp;&nbsp; &nbsp;__fastcall ~TSysRgrss();</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;struct vsedata {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int p;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //TDateTime t[600000];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double pr[50000];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //double bid[600000];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //double ask[600000];</div><div class="code_line">&nbsp;&nbsp; &nbsp;} vse[1];</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;void __fastcall NewTick(double price, int point, bool show);</div><div class="code_line">&nbsp;&nbsp; &nbsp;void __fastcall GotTrade(bool buy, double price, int id, int amount, int instr);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;void __fastcall RangeData(vsedata *v, double DiapMin, double DiapMax, &nbsp;double offset, int&amp; pivots, int&amp; length, double&amp; width, double brakeratio, bool&amp; broken, double&amp; moveup, double&amp; movedown, int tk, bool show);</div><div class="code_line">&nbsp;&nbsp; &nbsp;void __fastcall RangePointsSearch(vsedata *v, double DiapMin, double DiapMax, &nbsp;double offset, int&amp; pivots, int&amp; length, double&amp; width, double brakeratio, bool&amp; broken, int tk, bool show);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;int Step; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div><div class="code_line">&nbsp;&nbsp; &nbsp;int RegLength; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;int Compression; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;double Angle; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div><div class="code_line">&nbsp;&nbsp; &nbsp;double OldOrderOff; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;double Breakout; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div><div class="code_line">&nbsp;&nbsp; &nbsp;double MinStDev; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div><div class="code_line">&nbsp;&nbsp; &nbsp;double Stop; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;double MaxSize; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div><div class="code_line">&nbsp;&nbsp; &nbsp;double Size;</div><div class="code_line">};</div><div class="code_line">#endif</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>
<br>
Конструктор<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">//---------------------------------------------------------------------------</div><div class="code_line">#pragma hdrstop</div><div class="code_line">&nbsp;</div><div class="code_line">#include &quot;TSysRgrss.h&quot;</div><div class="code_line">#include &quot;Unit1.h&quot;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">//---------------------------------------------------------------------------</div><div class="code_line">#pragma package(smart_init)</div><div class="code_line">__fastcall TSysRgrss::TSysRgrss() &nbsp; // конструктор</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;//инициализация</div><div class="code_line">&nbsp;&nbsp; &nbsp;Step=100;</div><div class="code_line">&nbsp;&nbsp; &nbsp;Data=false;</div><div class="code_line">&nbsp;&nbsp; &nbsp;Trade=false;</div><div class="code_line">&nbsp;&nbsp; &nbsp;vse[0].p=0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;Order=0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;Position=0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;StepCounter=0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;LastPrice=0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;LastChange=0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;Lastbx=0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;PrevLength=200;</div><div class="code_line">&nbsp;&nbsp; &nbsp;jump=0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;HL.n = 0;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;RegLength=200;</div><div class="code_line">&nbsp;&nbsp; &nbsp;Compression=1;</div><div class="code_line">&nbsp;&nbsp; &nbsp;//Step=100;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;OldOrderOff=40; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div><div class="code_line">&nbsp;&nbsp; &nbsp;Stop=30; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;MaxSize=1; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;Size=1; &nbsp; &nbsp; &nbsp; &nbsp; </div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">__fastcall TSysRgrss::~TSysRgrss() &nbsp; // деструктор</div><div class="code_line">{</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; //</div><div class="code_line">}</div></ol></div></div></div></div>]]></description>
        <author>secondd</author>
        <category>Borland C++ Builder/Turbo C++ Explorer</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=413012&amp;view=findpost&amp;p=3771549</guid>
        <pubDate>Fri, 08 Jun 2018 08:50:58 +0000</pubDate>
        <title>Добавление переменной в хедер приводит к ошибке</title>
        <link>https://forum.sources.ru/index.php?showtopic=413012&amp;view=findpost&amp;p=3771549</link>
        <description><![CDATA[MBo: Есть вероятность неправильного обращения с памятью в каком-то другом месте, а введение нового поля просто выявило эту проблему.]]></description>
        <author>MBo</author>
        <category>Borland C++ Builder/Turbo C++ Explorer</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=413012&amp;view=findpost&amp;p=3771545</guid>
        <pubDate>Fri, 08 Jun 2018 08:02:25 +0000</pubDate>
        <title>Добавление переменной в хедер приводит к ошибке</title>
        <link>https://forum.sources.ru/index.php?showtopic=413012&amp;view=findpost&amp;p=3771545</link>
        <description><![CDATA[JoeUser: Код давай &quot;до&quot; и &quot;после&quot;.]]></description>
        <author>JoeUser</author>
        <category>Borland C++ Builder/Turbo C++ Explorer</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=413012&amp;view=findpost&amp;p=3771542</guid>
        <pubDate>Fri, 08 Jun 2018 07:24:54 +0000</pubDate>
        <title>Добавление переменной в хедер приводит к ошибке</title>
        <link>https://forum.sources.ru/index.php?showtopic=413012&amp;view=findpost&amp;p=3771542</link>
        <description><![CDATA[secondd: RAD 2009 C++ попал на странно-непонятное поведение, добавляю переменную в хедер класса (int,bool) в Private секцию и вся программа либо валится с экземпшеном либо работает, но как будто все переменные не инициализированы конструктором (все остальные). Переставил переменную на несколько строк выше, ошибка пропала. Добавил еще одну переменную так же выше - снова ошибки.<br>Подскажите пожалуйста кто-нибудь сталкивался с таким поведением?<br><br>Project TestRegress.exe raised exception class EAccessViolation with message &#39;Access violation at address 00D23E5D in module &#39;BORLNDMM.DLL&#39;. Write of address 00000001&#39;.]]></description>
        <author>secondd</author>
        <category>Borland C++ Builder/Turbo C++ Explorer</category>
      </item>
	
      </channel>
      </rss>
	