Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old May 23rd, 2006, 11:15 PM
A
Guest
 
Posts: n/a
Default Weird?

while compiling my code I get the following message:

matfunoperable.cpp: In member function ?virtual void
matfunoperable::qrdelete(gsl_matrix*, gsl_matrix*, size_t, char)?:
matfunoperable.cpp:32: warning: suggest parentheses around assignment
used as truth value
matfunoperable.cpp:35: warning: suggest parentheses around assignment
used as truth value



Code snippet that contains lines 32 and 35:

32 for (size_t iter = 0; iter = j-2; iter++){
33
gsl_vector_memcpy(&gsl_matrix_column(R_new,iter).v ector,&gsl_matrix_column(R,iter).vector);
34 }
35 for (size_t iter = j-1; iter = n-1; iter++){
36
gsl_vector_memcpy(&gsl_matrix_column(R_new,iter).v ector,&gsl_matrix_column(R,(iter+1)).vector);
37 }


prototype of the function (in the .h file) in which the above snippet
is contained is:

virtual void qrdelete(gsl_matrix *Q_new, gsl_matrix *R_new, const
size_t j, const char orient);


The executable is formed. However when I run the executable, none of
the instructions in main() are executed. Can anyone throw some light on
what is happening here?

Thanks,
A

  #2  
Old May 23rd, 2006, 11:25 PM
Ian Collins
Guest
 
Posts: n/a
Default Re: Weird?

A wrote:[color=blue]
> while compiling my code I get the following message:
>
> matfunoperable.cpp: In member function ?virtual void
> matfunoperable::qrdelete(gsl_matrix*, gsl_matrix*, size_t, char)?:
> matfunoperable.cpp:32: warning: suggest parentheses around assignment
> used as truth value
> matfunoperable.cpp:35: warning: suggest parentheses around assignment
> used as truth value
>
>
>
> Code snippet that contains lines 32 and 35:
>
> 32 for (size_t iter = 0; iter = j-2; iter++){[/color]

Common bug which your compiler is kind enough to point out - you are
using assignment (=) rather than equality (==).


--
Ian Collins.
  #3  
Old May 23rd, 2006, 11:25 PM
Noah Roberts
Guest
 
Posts: n/a
Default Re: Weird?


A wrote:[color=blue]
> while compiling my code I get the following message:
>
> matfunoperable.cpp: In member function ?virtual void
> matfunoperable::qrdelete(gsl_matrix*, gsl_matrix*, size_t, char)?:
> matfunoperable.cpp:32: warning: suggest parentheses around assignment
> used as truth value
> matfunoperable.cpp:35: warning: suggest parentheses around assignment
> used as truth value
>
>
>
> Code snippet that contains lines 32 and 35:
>
> 32 for (size_t iter = 0; iter = j-2; iter++){[/color]
[color=blue]
> The executable is formed. However when I run the executable, none of
> the instructions in main() are executed. Can anyone throw some light on
> what is happening here?[/color]

You're compiler is giving you a pretty good idea. Is it really your
intention to assign the value of j - 2 to iter and then test to make
sure the result is not 0?

What occurs is actually the best that could happen...other option is
infinite loop.

  #4  
Old May 23rd, 2006, 11:25 PM
Ian Collins
Guest
 
Posts: n/a
Default Re: Weird?

Ian Collins wrote:[color=blue]
> A wrote:
>[color=green]
>>while compiling my code I get the following message:
>>
>>matfunoperable.cpp: In member function ?virtual void
>>matfunoperable::qrdelete(gsl_matrix*, gsl_matrix*, size_t, char)?:
>>matfunoperable.cpp:32: warning: suggest parentheses around assignment
>>used as truth value
>>matfunoperable.cpp:35: warning: suggest parentheses around assignment
>>used as truth value
>>
>>
>>
>>Code snippet that contains lines 32 and 35:
>>
>>32 for (size_t iter = 0; iter = j-2; iter++){[/color]
>
>
> Common bug which your compiler is kind enough to point out - you are
> using assignment (=) rather than equality (==).
>[/color]
Or whatever comparison operator you intended.

--
Ian Collins.
  #5  
Old May 24th, 2006, 04:25 AM
A
Guest
 
Posts: n/a
Default Re: Weird?

Thank you all. This was so unexpected.
A

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,338 network members.