Pelles C forum

C language => Tips & tricks => Topic started by: colepc on March 29, 2015, 03:16:14 PM

Title: Blocking out text in C - What I do
Post by: colepc on March 29, 2015, 03:16:14 PM
Sometimes I like to block out a group of text temporarily. As I only use "//" for all of my comments, it is easy for me to use "/* */" to block out that text. Later it is easy for me to find that blocked out text. Note: Nested  "/* */" cause problems with most compilers including PellesC. Of course if your code is hopelessly infested with too many "/* */", you can always block out text using "#ifdef xxx - #endif" statements (a little harder to type).

Following are why I block out text:
1. To copy a group of hard to remember variables for reference nearer to the place I'm adding some new C code. After using it I then delete it.
2. To copy a block of C code to an area that I'm adding new code that is similar to the copied code. I then use/modify/reference that copied code a little bit at a time until the new code is fully developed.
3. To block out C code to see if it is causing a hard to find problem. If blocking it out stops the problem then I'll add a little of the code back until the problem returns.
Title: Re: Blocking out text in C - What I do
Post by: TimoVJL on March 29, 2015, 06:51:57 PM
you can always block out text using "#ifdef xxx - #endif" statements (a little harder to type).
Easy with content menu -> Surround by -> #if 0 - #endif