question - optimization and const

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi.
 Suppose I have some array of double "mymatrix[10][10]" ,
which I pass to some library function (namely to the Lapack's DORMQR).

That function modifies the contents of the array "mymatrix" during
it's work (uses it as a workspace), but always at the end of the
call restores it's contents.

Question: May I mark "mymatrix" as "const" ? i.e.

void my_fuction( const double mymatrix[10][10] ) {
   call_to_fortran_DORMQR( ..., mymatrix, ...);
}


In such a way I hint to the gcc's optimizer that the contents
of the matrix are read only in the scope of "my_function",
but actually they will be changed and than restored.

Can it create trouble with the optimization, i.e. that the resulting
executable will produce incorrect results ?

Thank you,
Regards,
 Dima.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux