gartenriese
gartenriese

Reputation: 4356

Illegal instruction error when calling function with return type

I have an empty function with a return type, let's say

int g() {}

When I call g, I get an Illegal instruction error. If I change the function to

void f() {}

everything's fine.

What could be a reason for this strange behaviour? Code looks like this:

WindowID w = e.createWindow(800, 800);
w.f();
w.g();

where createWindow() creates a new thread. Could it be something with threads? I changed the name and the return type of g(), but I always get an Illegal instruction. This seems such a strange error to me, it must be something really simple. But what?

Upvotes: 1

Views: 1263

Answers (1)

adam
adam

Reputation: 240

If I understand well your problem, it's absolutely not a strange behaviour.

When you say that a function has a return type int you must return an integer in all cases from that function. You can only create an empty function if its return type is void.

Upvotes: 4

Related Questions