By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,148 Members | 748 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,148 IT Pros & Developers. It's quick & easy.

Weird?

P: n/a
A
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

May 23 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
A wrote:
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++){


Common bug which your compiler is kind enough to point out - you are
using assignment (=) rather than equality (==).
--
Ian Collins.
May 23 '06 #2

P: n/a

A wrote:
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++){ 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?


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.

May 23 '06 #3

P: n/a
Ian Collins wrote:
A wrote:
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++){

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

Or whatever comparison operator you intended.

--
Ian Collins.
May 23 '06 #4

P: n/a
A
Thank you all. This was so unexpected.
A

May 24 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.