see these line: for (unsignedint index=blnFunction? 2 : 1 , varcount=1; index< blnFunction? ...
i don't get any compiler errors, but when i execute it, the exe give me an error(like an exit error)..
but if i use the parentheses, will works normaly: for (unsignedint index=(blnFunction? 2 : 1) , varcount=1; index< (blnFunction? CodeLine.size(): CodeLine.size()-1);...
why the compiler don't give me an error\warning about using it with or without parenthese?
You're completely changing the meaning by adding those parenthese.
First, did you actually mean = , or did you mean == ?
What are you trying to do with index? Are you trying to set it equal to blnFunction, or are you trying to set it to the value 2 or 1, depending on blnFunction?
> why the compiler don't give me an error\warning about using it
Some compilers do warn you if warnings are enabled.
1 2 3 4 5 6 7 8 9 10 11 12 13
int main()
{
externbool b ;
for( int i = b ? 2 : 1 , v = 1 ; i < b ? 10 : 20 ; ++i, ++v ) ;
// GNU (-Wall -Wextra):
// warning: ?: using integer constants in boolean context, the expression will always evaluate to 'true' [-Wint-in-bool-context]
// 5 | for( int i = b ? 2 : 1 , v = 1 ; i < b ? 10 : 20 ; ++i, ++v ) ;
// | ~~~~~~^~~~~~~~~
// Microsoft (-W4):
// warning C4804: '<': unsafe use of type 'bool' in operation
}