Warning: statement with no effect

Posted on 2008-11-03
Last Modified: 2008-11-03
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

Question by:bejhan
    LVL 53

    Accepted Solution

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

    == is the comparison operator.
    = is the assignment operator.
    LVL 1

    Author Comment

    Oh jeez, it should say Warning: Get some glasses :P
    LVL 53

    Expert Comment

    heh ;)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
    Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode ( They will have you believe that Unicode requires you to use…
    The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
    The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now