• C

Warning: statement with no effect

When I compile this in GCC with the -Wall option (required in my class) I get:

Warning: statement with no effect

This is on the lines where newX and newY are assigned values. I don't understand how this statement has no effect, newX and newY are receiving a new value aren't they?
void RotateMatrix(LINKEDLIST *matrices, char *line) {
	char name[MAX_MATRIX_NAME_LENGTH + 1];
	memset(name, 0, sizeof(name));
	long rotationAngle;
	//Parse the line to extract name and rotation angle
	int result = sscanf(line, "%*s %s %ld", name, &rotationAngle);
	if(result != 2) {
		char *error = "Couldn't extract matrix name/angle from rotate command";
		fprintf(stderr, error);
	matrices->cursor->content = GetMatrix(matrices, name);
	long x, y, newX, newY;
	LINKEDLIST *coordinates = ((MATRIX *) matrices->cursor->content)->coordinates;
	coordinates->cursor = coordinates->head;
	while(coordinates->cursor != NULL) {
		x = ((COORDINATE *) coordinates->cursor->content)->x;
		y = ((COORDINATE *) coordinates->cursor->content)->y;
		switch(rotationAngle) {
			case 90:
				newX == -y;
				newY == x;
			case 180:
				newX == -x;
				newY == -y;
			case 270:
				newX == y;
				newY == -x;
		((COORDINATE *) coordinates->cursor->content)->x = newX;
		((COORDINATE *) coordinates->cursor->content)->y = newY;
		coordinates->cursor = coordinates->cursor->next;

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

>> This is on the lines where newX and newY are assigned values.

== is the comparison operator.
= is the assignment operator.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bejhanAuthor Commented:
Oh jeez, it should say Warning: Get some glasses :P
heh ;)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.