Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: bahdom on December 28, 2008, 06:02:11 am

Title: Code Grouping
Post by: bahdom on December 28, 2008, 06:02:11 am
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
Title: Re: Code Grouping
Post by: ollydbg on December 28, 2008, 08:01:34 am
Please give some piece of your code. Thanks.
Title: Re: Code Grouping
Post by: 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

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.
Title: Re: Code Grouping
Post by: ollydbg on December 28, 2008, 01:45:13 pm
When I want to group code inside a file, I use:
Code
//{Meaningful section start
...(code to group)
//}Meaningful section end

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.
This is an informative message.
Thanks for sharing the trick.
It should be added to wiki page, :D.