• Create Account

# BitMaster

Member Since 08 Aug 2000
Online Last Active Today, 08:49 AM

### #5166234(Super) Smart Pointer

Posted by on 11 July 2014 - 10:13 AM

shared_ptr doesn't seem to work because that is reference counted.

Or of course simply a weak_ptr.

### #5165554STL Map and SDL2 Texture segfault

Posted by on 08 July 2014 - 09:12 AM

If something crashes deep inside the C++ standard library (although a lot of people call it carelessly the 'STL', it is not) you should walk up the stack trace and see what you are doing. Bugs in the standard library happen, but are not common at all. In practically all cases, the error is with you.

You posted a bit limited code (and no one knows how it looks now anyway), so here are two hints:
- if you add pointers to any local objects, you very likely should not do that
- if you add objects to the map, you need to make sure they respect the Rule of Three

### #5165483raw binary to obj conversion

Posted by on 08 July 2014 - 02:19 AM

Have you evaluated GNU's Binary File Descriptor library referenced in the Wikipedia article?

### #5165466STL Map and SDL2 Texture segfault

Posted by on 08 July 2014 - 12:27 AM

Run it through a debugger and observe the lines it is crashing on and check the state of everything when that happens. If you don't know how your debugger works yet, now is a perfect time to learn. A simple, reliably to reproduce crash is the textbook example for it.

That said, have you dealt with what rip-off said in post #4?

### #5165342STL Map and SDL2 Texture segfault

Posted by on 07 July 2014 - 02:08 PM

In general I found the C++11 Wikipedia article to be a helpful overview, combined with cppreference.com for more details.

### #5165039STL Map and SDL2 Texture segfault

Posted by on 06 July 2014 - 07:55 AM

textureLibrary[filename.c_str()] = newTexture;

That does not look healthy at all. Whatever filename.c_str() returns is only guaranteed to live during that statement. The map should be of type std::map<std::string, whatever> and then you should not call std::string::c_str() here.

### #5163772sse-alignment troubles

Posted by on 30 June 2014 - 01:17 AM

Don't get me wrong I'm not defending/offending him, I just try to exchange useful information with all of you.
I think that if you put a downvote on someones post, you MUST tell him why he is wrong, at the end of the date we are programmers we use facts.

In an ideal world, yes. In practice, you need to check fir's history. The surprising thing is not he is getting downvoted without further comment, the surprising thing is there are people left who are actually willing to engage with him in something resembling a constructive way. Whatever else he is, he is very good at burning bridges for absolutely no reason at all.

### #5162967Legal stuff when using free art / models in an own game

Posted by on 26 June 2014 - 02:48 AM

No, you did not find out how it was resolved. The key part is "did not disclose terms of the settlement". For all you know NCSoft needed to pay millions of dollars to "proceed unhindered".

### #5162720TILED/LUA - Integration with C

Posted by on 25 June 2014 - 12:41 AM

That appears to be a simple Lua table definition.

### #5162716Is this multiplication formula in linear algebra true?

Posted by on 25 June 2014 - 12:12 AM

But that is not possible since xT=!=x. What I find strange though (for example, dot product of x and xT is defined, thus their subtraction is defined, but thus subtraction of x and xT can never be a zero vector)

First, you cannot have a dot product of $$x$$ and $$x^T$$ (unless $$x \in \mathbb R$$). The dot product is for two column vectors $$u, v$$ is commonly defined as $$dot(u, v) := u^T \cdot v$$. Trying $$dot(x^T, x)$$ would once again be impossible because you would have to multiply an element of $$\mathbb R^{n \times 1}$$ with and element of $$\mathbb R^{n \times 1}$$ which is not defined for $$n \neq 1$$.

To every vector (matrix) exists addition neutral vector (matrix) Z
To every vector (matrix) exists multiplication neutral vector (matrix) I such that V*I=V
To every vector (matrix) exists multiplication inverse vector J (matrix) such that V*J=I

You are thinking of the ring axioms but that applies only to square matrices. You cannot even multiply general vectors together like that (as already said above), so talking about multiplicative neutral and multiplicative inverse elements for vectors does not make any sense.
In some fields (like GLSL) it can be convenient to define a component-wise vector multiplication. However, that is something completely orthogonal to standard linear algebra. The presence of this extra operator does not change anything about the theory of matrices nor does it negate associativity of matrix multiplication.

I can only reinforce Álvaro's suggestion to "go learn some math", ideally under supervision. You apparently heard of several concepts but you are lacking the attention to detail and strictness required in the field.

Álvaro: I often smell troll on these forums but with him I'm more inclined to believe he actually believes what he is saying.

### #5162630Is this multiplication formula in linear algebra true?

Posted by on 24 June 2014 - 02:16 PM

Well, that was my argument to him in the original thread, but as he says now

I would cite now "but then you would have to test a row and column vector for equality, which just does not work.". I am comparing vectors of the same majoring (dimensions).

which has me a bit at a loss for words.

### #5162515Why does this matrix multiplication order matter?

Posted by on 24 June 2014 - 06:17 AM

a helping true algebraic statement:
P*V*M*p=p*M*V*P  (becouse P*V*M=(M*V*P) T)

How is that even supposed to work? A matrix multiplication M1 * M2 is only defined if M1 is a (n x k) matrix and M2 is a (k x m) matrix. The result is then a (n x m) matrix. One side effect of this is that you can transpose M, V and P but the only place the vector (a (4 x 1) matrix) can be is at the right-most side. You could multiply it from the left as a row-vector p^T (a (1 x 4) matrix) but then you would have to test a row and column vector for equality, which just does not work.

### #5161294Code::Blocks: Process terminated with status -1073741819

Posted by on 18 June 2014 - 06:25 AM

I would strongly suggest learning to work with your debugger.

### #5160265Qt Widgets resizing incorrectly

Posted by on 13 June 2014 - 05:00 AM

I can't be certain since I don't know the widgets in question but I would assume they set different preferredHeights depending on what data they contain. It should be probably be enough to set the same non-zero stretch factor for each row.

### #5160047Why does this not compile?

Posted by on 12 June 2014 - 08:55 AM

Well, the OP uses g++, so worst case he needs to add --std=c++11 depending on what his defaults are. Unless his gcc is really old.

PARTNERS