hello! I am trying to learn how to do paralell processing. I am baseing this on an example that I saw here:
the one titled "SSETest Demo Project"

I tried to make my own, and don't understand why it isn't working. Here is the code:

// testconsole.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include <time.h>
#include <iostream>
#include "windows.h"
#include "math.h"
#include <conio.h>
#include "test.h"
#include <xmmintrin.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
	float *f1 = new float[4];
	float *f2 = new float[4];
	float *result = new float[4];

	for(int i = 0; i < 4; i++)
		f1[i] = (float)i;
		f2[i] = (float)i;
	__m128 *m1 = (__m128*)f1;
	__m128 *m2 = (__m128*)f2;
	__m128 *res = (__m128*)result;
//the next line produces the error: "Unhandled exception at 0x0125149c in 
//testconsole.exe: 0xC0000005: Access violation reading location 0xffffffff."
	*res = _mm_add_ps(*m1, *m2); //access violation reading
	for(int i = 0; i < 4; i++)
		cout << result[i] << endl;
	return 0;

the strangest part, is even though it produces the error at that line, I do NOT get the error if I comment out the second for loop and the getch(). It simply runs, exits, no error.

can anyone help me out?
Thanks =)

thanks for the help! I had a little sample app running, which was working outside the IDE, but not inside..thought it was strange...
it must have been aligning itself by some fluke..LoL

This question has already been answered. Start a new discussion instead.