Andes Workshop

It is currently Fri Mar 29, 2024 2:56 am

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: FlexeLint檢查會被最佳化的略去的loop
PostPosted: Thu Jan 24, 2013 6:07 pm 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
這一篇只是要告訴大家Lint tool的作用,
Lint是一個程式的靜態分析軟體。

static analysis tools
http://en.wikipedia.org/wiki/List_of_to ... .2FC.2B.2B

-----------------------------------------------------------
有加 volatile 的 delay loop 通過 FlexeLint 的檢查。
沒有 volatile 的 delay loop 會有警告訊息:
Warning 522: Highest operation, function 'delay', lacks side-effects
========
FlexeLint for C/C++ (Unix) Vers. 9.00i, Copyright Gimpel Software 1985-2012
--- Module: delay.c (C)

delay.c
#include <stdio.h>
#define TICK 10000000
void delay(int sum)
{
volatile int j;
volatile int k;
for(j = 0; j < sum; j++) {
for(k = 0; k < TICK; k++) {
}
}
}

int main()
{
int i;
printf("Hello\n");
for(i = 0; i < 5; i++) {
printf("Go %d\n", i);
delay(10);
}
}


flint.sh delay.c
FlexeLint for C/C++ (Unix) Vers. 9.00i, Copyright Gimpel Software 1985-2012
--- Module: delay.c (C)
_
delay(10);
delay.c 25 Warning 522: Highest operation, function 'delay', lacks
side-effects

delay.c
// volatile int j;
// volatile int k;
int j;
int k;


Top
 Profile Send private message E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group