Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
Need sharp criticism on my code.
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="grishin-mailing-lists, post: 4066492"] Thank you, Ben. I've considered all of your suggestions. I spent about an hour to get this invariant while (fgets( buff, sizeof buff, fp ) && !(strstr( buff, cDefinition ) && !( strstr( buff, s_case1 ) || strstr( buff, s_case2_1 ) || strstr( buff, s_case2_2 ) || strstr( buff, s_case3 ) ))) { } but it seems to me as "too much" because it would be difficult to add something (especially after a year or two). I decided to have this one: while (fgets( buff, sizeof buff, fp )) { if (strstr( buff, cDefinition ) && !( strstr( buff, s_case1 ) || strstr( buff, s_case2_1 ) || strstr( buff, s_case2_2 ) || strstr( buff, s_case3 ) )) { break; } } Neat enough and can be easily modified. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Need sharp criticism on my code.
Top