User forums > Using Code::Blocks
Code Grouping
(1/1)
bahdom:
Is there some way to group related code inside a class? For example, if dealing with a renderer class I'd like to group all the methods related to dealing with surfaces, all those with displaying on screen, etc.
I tried doing this with { }, but I got an error message from the compiler. Is there some other way of doing this in CodeBlocks?
Thanks
ollydbg:
Please give some piece of your code. Thanks.
Ganbito:
When I want to group code inside a file, I use:
--- Code: ---//{Meaningful section start
...(code to group)
//}Meaningful section end
--- End code ---
As the brackets are into comments, compiler don't try to parse them and don't throw an error but codeblocks notice them and put an '+' symbol on the margin so I can hide an show this section, regardless of that is not a code section following the language rules.
ollydbg:
--- Quote from: Ganbito on December 28, 2008, 12:58:16 pm ---When I want to group code inside a file, I use:
--- Code: ---//{Meaningful section start
...(code to group)
//}Meaningful section end
--- End code ---
As the brackets are into comments, compiler don't try to parse them and don't throw an error but codeblocks notice them and put an '+' symbol on the margin so I can hide an show this section, regardless of that is not a code section following the language rules.
--- End quote ---
This is an informative message.
Thanks for sharing the trick.
It should be added to wiki page, :D.
Navigation
[0] Message Index
Go to full version