What am I supposed to return here?

Hey all. Here is the declaration of my thread function:

unsigned __stdcall aquireData(void * param);

I'm not returning anything from the function, but the compiler says I should be.

What type should I be returning? From what I've read __stdcall is just letting the compiler know the calling convention, leaving unsigned as the return type? Is this unsigned int, unsigned float or unsigned char lol I have no idea.

Thanks a lot.

Nick.

closed account (Lv0f92yv)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
#include <string>

using namespace std;
unsigned getvar();

int main()
{
	int alpha = getvar();
	cout << alpha << "\\n";
	return 0;
}

unsigned getvar()
{
	return 2;
}



Seems to work for me. Note that I am returning an int here. I have alsa tested with short, long, and char. All compile and appear to work.

I believe unsigned can be used with any datatype that would otherwise go to unsigned.
Thanks for that!
I guess I should chime in here...

unsigned is just a shorter way of typing unsigned int. (just like "short" is a shorter way of typing "short int")

returning shorts and chars will also work because they can be implicitly cast up to an unsigned int.
Topic archived. No new replies allowed.