rule to check does every control statements have body.

hi,

i need to write a rule to check does control statements such if,for and while has body?

i also need to check do all switch statements have default? Plz help me writing these rules.

Thanks in advance...

[234 byte] By [Guns] at [2007-12-21]
# 1

Hi Guns,

if,for and while statements are all higher level constructs that get compiled away. In IL you'll only be able to find branch & jump statements. As said in my other post, you'll need dataflow to really detect loops well and then you won't be able to see if it was a for, foreach, while or do while loop as that information is just not available in IL.

Regards,

Jeffrey

JeffreyvanGogh-MSFT at 2007-9-10 > top of Msdn Tech,Visual Studio Team System,Visual Studio Code Analysis and Code Metrics...

Visual Studio Team System

Site Classified