# A method of static code analysis

Discussion in 'C Programming' started by Logan Lee, Dec 24, 2007.

1. ### Logan LeeGuest

This is a method I have devised.

Not really organized but
http://www.geocities.com/logan.lee30/Definitions_and_examples.pdf.

Definitions

I=if; EI=else if; E=else

(I) is one of I, EI, E or I, EI or I, E.
(I)[3]=I, EI, E
(I)[2]=I, EI or I, E.

Let ((I))_1 be F, (I)_i, F and ((I))_2 be (I)_i, F, (I)_j. Then:

((I))_1[5]=F, (I)[3], F
((I))_2[7]=(I)[3], F, (I)[3].

Sample Code:

Let's try to represent(I apologise for incorrect syntax in relation to
ANSI C):

for
if
else if

in terms of our definition above.

It is equivalent to ((I))_1[3] or F, (I)[2]. Actually ((I))_1[3]=F, (I)[2].

Note that this is ambiguous because we haven't distinguished between
(I)[2]= I, EI or I, E. But this is a minor issue that can be resolved very
easily. The point is that using my method we are able to quickly classify
a certain control loop structure found in ANSI C code. Tell me what you
think. Thanks.

Logan Lee, Dec 24, 2007

2. ### Logan LeeGuest

More comprehensive example

Mon, 24 Dec 2007 01:39:14 +0000ì—, Logan Lee ì¼ìŠµë‹ˆë‹¤:

> This is a method I have devised.
>
> Not really organized but
> http://www.geocities.com/logan.lee30/Definitions_and_examples.pdf.
>
> Definitions
>
> I=if; EI=else if; E=else
>
> (I) is one of I, EI, E or I, EI or I, E.
> (I)[3]=I, EI, E
> (I)[2]=I, EI or I, E.
>
> Let ((I))_1 be F, (I)_i, F and ((I))_2 be (I)_i, F, (I)_j. Then:
>
> ((I))_1[5]=F, (I)[3], F
> ((I))_2[7]=(I)[3], F, (I)[3].
>
> Sample Code:
>
> Let's try to represent(I apologise for incorrect syntax in relation to
> ANSI C):
>
> for
> if
> else if
>
> in terms of our definition above.
>
> It is equivalent to ((I))_1[3] or F, (I)[2]. Actually ((I))_1[3]=F, (I)[2].
>
> Note that this is ambiguous because we haven't distinguished between
> (I)[2]= I, EI or I, E. But this is a minor issue that can be resolved very
> easily. The point is that using my method we are able to quickly classify
> a certain control loop structure found in ANSI C code. Tell me what you
> think. Thanks.

http://www.geocities.com/logan.lee30/more_comprehensive_example.html

Logan Lee, Dec 24, 2007

3. ### Logan LeeGuest

Sorry but 'F' stands for 'for'

Mon, 24 Dec 2007 01:39:14 +0000ì—, Logan Lee ì¼ìŠµë‹ˆë‹¤:

> This is a method I have devised.
>
> Not really organized but
> http://www.geocities.com/logan.lee30/Definitions_and_examples.pdf.
>
> Definitions
>
> I=if; EI=else if; E=else
>
> (I) is one of I, EI, E or I, EI or I, E.
> (I)[3]=I, EI, E
> (I)[2]=I, EI or I, E.
>
> Let ((I))_1 be F, (I)_i, F and ((I))_2 be (I)_i, F, (I)_j. Then:
>
> ((I))_1[5]=F, (I)[3], F
> ((I))_2[7]=(I)[3], F, (I)[3].
>
> Sample Code:
>
> Let's try to represent(I apologise for incorrect syntax in relation to
> ANSI C):
>
> for
> if
> else if
>
> in terms of our definition above.
>
> It is equivalent to ((I))_1[3] or F, (I)[2]. Actually ((I))_1[3]=F, (I)[2].
>
> Note that this is ambiguous because we haven't distinguished between
> (I)[2]= I, EI or I, E. But this is a minor issue that can be resolved very
> easily. The point is that using my method we are able to quickly classify
> a certain control loop structure found in ANSI C code. Tell me what you
> think. Thanks.

Logan Lee, Dec 24, 2007
4. ### Logan LeeGuest

I've retyped this and stored in URL so look if you want

Mon, 24 Dec 2007 01:39:14 +0000ì—, Logan Lee ì¼ìŠµë‹ˆë‹¤:

> This is a method I have devised.
>
> Not really organized but
> http://www.geocities.com/logan.lee30/Definitions_and_examples.pdf.
>
> Definitions
>
> I=if; EI=else if; E=else
>
> (I) is one of I, EI, E or I, EI or I, E.
> (I)[3]=I, EI, E
> (I)[2]=I, EI or I, E.
>
> Let ((I))_1 be F, (I)_i, F and ((I))_2 be (I)_i, F, (I)_j. Then:
>
> ((I))_1[5]=F, (I)[3], F
> ((I))_2[7]=(I)[3], F, (I)[3].
>
> Sample Code:
>
> Let's try to represent(I apologise for incorrect syntax in relation to
> ANSI C):
>
> for
> if
> else if
>
> in terms of our definition above.
>
> It is equivalent to ((I))_1[3] or F, (I)[2]. Actually ((I))_1[3]=F, (I)[2].
>
> Note that this is ambiguous because we haven't distinguished between
> (I)[2]= I, EI or I, E. But this is a minor issue that can be resolved very
> easily. The point is that using my method we are able to quickly classify
> a certain control loop structure found in ANSI C code. Tell me what you
> think. Thanks.

http://www.geocities.com/logan.lee30/A_method_of_static_code_analysis.html

Logan Lee, Dec 24, 2007
5. ### Remo D.Guest

Re: I've retyped this and stored in URL so look if you want

Logan Lee ha scritto:
>> This is a method I have devised.
>> Definitions
>>
>> I=if; EI=else if; E=else
>> [...]

Sorry Logan, I might have missed it. Which problem are you trying to solve?

Remo.D

Remo D., Dec 24, 2007
6. ### Mark McIntyreGuest

On Mon, 24 Dec 2007 01:39:14 +0000, Logan Lee wrote:

> This is a method I have devised.

(snip )

> very easily. The point is that using my method we are able to quickly
> classify a certain control loop structure found in ANSI C code. Tell me
> what you think. Thanks.

Euh, what exactly is the problem you're trying to solve, and how is it a
C problem?

Mark McIntyre, Dec 24, 2007