Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2849
  • Last Modified:

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);
		exit(EXIT_FAILURE);
	}
 
	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;
				break;
			case 180:
				newX == -x;
				newY == -y;
				break;
			case 270:
				newX == y;
				newY == -x;
				break;
		}
 
		((COORDINATE *) coordinates->cursor->content)->x = newX;
		((COORDINATE *) coordinates->cursor->content)->y = newY;
 
		coordinates->cursor = coordinates->cursor->next;
	}
 
	return;
}

Open in new window

0
bejhan
Asked:
bejhan
  • 2
1 Solution
 
Infinity08Commented:
>> This is on the lines where newX and newY are assigned values.

== is the comparison operator.
= is the assignment operator.
0
 
bejhanAuthor Commented:
Oh jeez, it should say Warning: Get some glasses :P
0
 
Infinity08Commented:
heh ;)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now