hi all,
apart from readability, and not wanting the otherwise different
statements to be assumed as one single loong statement [ the comma
operator ]
what are the pros/cons of both snippets?
i tried this out on a small piece of code and the latter part using
short circuiting takes about half the time as the if else version;
gcc 3.2 , amdk6-2 running vectorlinux;
cheers
ram
herz a snippet of code..
=============== === 1
int flag = f ;
if( f)
{ if1() ;
if2() ;
if3() ;
}
else
{ e1() ;
e2() ;
}
=============== ===== 2 =
int flag = f ;
(
(
( f ) && ( if1() ,
if2() ,
if3()
)
) ||
( e1() , e2()
)
)
)
=============== ==== end of snippets;
apart from readability, and not wanting the otherwise different
statements to be assumed as one single loong statement [ the comma
operator ]
what are the pros/cons of both snippets?
i tried this out on a small piece of code and the latter part using
short circuiting takes about half the time as the if else version;
gcc 3.2 , amdk6-2 running vectorlinux;
cheers
ram
herz a snippet of code..
=============== === 1
int flag = f ;
if( f)
{ if1() ;
if2() ;
if3() ;
}
else
{ e1() ;
e2() ;
}
=============== ===== 2 =
int flag = f ;
(
(
( f ) && ( if1() ,
if2() ,
if3()
)
) ||
( e1() , e2()
)
)
)
=============== ==== end of snippets;
Comment