Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - Problems with the implementation of the compiler optimization within Momentics 4.7.0 (maybe a bug??): Page 1 of 4 (4 Items)
   
Problems with the implementation of the compiler optimization within Momentics 4.7.0 (maybe a bug??)  
I am using the QNX Momentics IDE (4.7.0 on Windows) and encountered the following problem which I assume to be a bug of 
the compiler.
When I am writing following in my C file (within a QNX C Project) …
static const float SQRT_2 = sqrt(2);
static float SQRT_2_DIV2 = SQRT_2/2.0;
(that way I try to avoid unnecessary calculation) … I get following error message from the compiler, which I see in the
 “Problems”-View …

initializer element is not constant.

while following line is undelined red ...
static float SQRT_2_DIV2 = SQRT_2/2.0;

Well, on one side I could take this but what I really do not understand is, why the compiler do not detect this “error
” when I compile the same code with a Level 3 optimization? I thought the optimization process is started after parsing
 and syntax validation and should not effect the syntax rules.

Would be glad about some help in this situation.

Ahh, and yes, I tried the -Wc,-std=c99 parameter in the compiler settings but what I get are more and more errors which 
seems to be absolute pointless because I have a good book in front of me where C99 is used and the compiler start to 
tell me that simply everything is false (sounds a bit nonprofessional but I see just red lines).