<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Hilfe! Seltsamer Pointer?!?]]></title><description><![CDATA[<p>Hallo, Leute! Ich weiss gar nicht, ob ich in diesem Forum richtig bin, aber ich brauch mal wieder eure Hilfe!</p>
<p>Ich lasse folgende Schleife durchlaufen:</p>
<pre><code class="language-cpp">for(int i=0;i&lt;kNumJunctions;i++)
	{
		m_theJunctions[i]-&gt;computeOutput();
	}
</code></pre>
<p>Die aufgerufene Function sieht so aus:</p>
<pre><code class="language-cpp">void PMDummyJunction::computeOutput()
{
(*m_output)=-(1-m_fIndependentLoss)
*(m_fDependentLoss*m_trebleLossFilter-&gt;getOutput(m_input)
+(1-m_fDependentLoss)*m_input);
}
</code></pre>
<p>Jetzt das Problem:<br />
Just, wenn die Schleife durch ist, ist der &quot;trebleLossFilter&quot;-Pointer von<br />
m_theJunctions[0] auf 0x80000000 und damit natürlich ungültig.<br />
Wie kann das sein? Bis kurz vor ende der Schleife steht er noch richtig, nach dem letzten durchlauf ist er verändert...</p>
<p>So sehen die Klassendeklarationen aus:</p>
<pre><code class="language-cpp">class PMDummyJunction :public PMWGJunction
{
public:
	PMDummyJunction(void);
	virtual~PMDummyJunction(void);
	void computeOutput();
	float* getInputPtr(int pos){return &amp;m_input;}
	void setOutputPtr(float* ptr,int pos){m_output=ptr;}
	void setFDependentLoss(float loss){m_fDependentLoss=loss;}
	void setFIndependentLoss(float loss){m_fIndependentLoss=loss;}
	void endConnectionPhase(){;}
	void setImpedance(float impedance,int pos){;}
protected:
	float m_input;
	float *m_output;
	//Treble-loss filter related
	PMFirstOrderIir* m_trebleLossFilter;
	PMFilterDesigner filterDesigner;
	PMFilterDescriptor filterDescriptor;
	float m_fDependentLoss,m_fIndependentLoss;
};
class PMWGJunction
{
public:
	PMWGJunction(void);
	virtual ~PMWGJunction(void);
	virtual void computeOutput()=0;
	virtual float* getInputPtr(int pos)=0;
	virtual void setOutputPtr(float* ptr,int pos)=0;
	virtual void endConnectionPhase()=0;
	virtual void setImpedance(float impedance,int pos)=0;
protected:
};
</code></pre>
<p>Habt ihr ne Idee was da schief läuft?<br />
Viiiieeelen Dank<br />
Sören</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/199195/hilfe-seltsamer-pointer</link><generator>RSS for Node</generator><lastBuildDate>Sat, 03 Oct 2026 00:47:56 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/199195.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 29 Nov 2007 19:17:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Hilfe! Seltsamer Pointer?!? on Thu, 29 Nov 2007 19:17:07 GMT]]></title><description><![CDATA[<p>Hallo, Leute! Ich weiss gar nicht, ob ich in diesem Forum richtig bin, aber ich brauch mal wieder eure Hilfe!</p>
<p>Ich lasse folgende Schleife durchlaufen:</p>
<pre><code class="language-cpp">for(int i=0;i&lt;kNumJunctions;i++)
	{
		m_theJunctions[i]-&gt;computeOutput();
	}
</code></pre>
<p>Die aufgerufene Function sieht so aus:</p>
<pre><code class="language-cpp">void PMDummyJunction::computeOutput()
{
(*m_output)=-(1-m_fIndependentLoss)
*(m_fDependentLoss*m_trebleLossFilter-&gt;getOutput(m_input)
+(1-m_fDependentLoss)*m_input);
}
</code></pre>
<p>Jetzt das Problem:<br />
Just, wenn die Schleife durch ist, ist der &quot;trebleLossFilter&quot;-Pointer von<br />
m_theJunctions[0] auf 0x80000000 und damit natürlich ungültig.<br />
Wie kann das sein? Bis kurz vor ende der Schleife steht er noch richtig, nach dem letzten durchlauf ist er verändert...</p>
<p>So sehen die Klassendeklarationen aus:</p>
<pre><code class="language-cpp">class PMDummyJunction :public PMWGJunction
{
public:
	PMDummyJunction(void);
	virtual~PMDummyJunction(void);
	void computeOutput();
	float* getInputPtr(int pos){return &amp;m_input;}
	void setOutputPtr(float* ptr,int pos){m_output=ptr;}
	void setFDependentLoss(float loss){m_fDependentLoss=loss;}
	void setFIndependentLoss(float loss){m_fIndependentLoss=loss;}
	void endConnectionPhase(){;}
	void setImpedance(float impedance,int pos){;}
protected:
	float m_input;
	float *m_output;
	//Treble-loss filter related
	PMFirstOrderIir* m_trebleLossFilter;
	PMFilterDesigner filterDesigner;
	PMFilterDescriptor filterDescriptor;
	float m_fDependentLoss,m_fIndependentLoss;
};
class PMWGJunction
{
public:
	PMWGJunction(void);
	virtual ~PMWGJunction(void);
	virtual void computeOutput()=0;
	virtual float* getInputPtr(int pos)=0;
	virtual void setOutputPtr(float* ptr,int pos)=0;
	virtual void endConnectionPhase()=0;
	virtual void setImpedance(float impedance,int pos)=0;
protected:
};
</code></pre>
<p>Habt ihr ne Idee was da schief läuft?<br />
Viiiieeelen Dank<br />
Sören</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1412539</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1412539</guid><dc:creator><![CDATA[soerenP]]></dc:creator><pubDate>Thu, 29 Nov 2007 19:17:07 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe! Seltsamer Pointer?!? on Thu, 29 Nov 2007 19:25:25 GMT]]></title><description><![CDATA[<p>Kommando zurück!<br />
Hab ihn gefunden: Der output Pointer von m_theJunctions[5] war falsch gesetzt und hat mal eben den m_trebleLoss-Pointer ruiniert.<br />
Ciao<br />
Sören</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1412545</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1412545</guid><dc:creator><![CDATA[soerenP]]></dc:creator><pubDate>Thu, 29 Nov 2007 19:25:25 GMT</pubDate></item></channel></rss>