Archived

This topic is now archived and is closed to further replies.

Odd/Dumb MSVC7.1 Specific Question | Code Organization

This topic is 4944 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, A company I have been doing some side-coding for has recently upgraded from MSVC7 to MSVC7.1 and something very interesting has caught my eye. That is the inclusing of that code-tree thingy from VB and C#. If I knew the actual name I would quickly tell you, but that the problem, I dont. Its just a handy way of managing your code, as you can quickly close down functions/classes you dont need to look at at the moment, and make it quick to go through. If I knew the name of this functionality I could probably answer this myself, so If anyone knows the name I could probably find my answer through google.... Now for the question, I am trying to figure out how to control its formatting so that I can get certain comments excluded so that they DONT close down. The most notable reasoning is things such as comments before top level functions, or splitting the file header up (IE: comments and the includes and stuff all close into one big thing together, and I cant write what the code is) Sorry if this is a very un-readable post. I have frustrated myself to no end on this, in hopes it will help in the future. Thanks.

Share this post


Link to post
Share on other sites
Do you mean code outlining?

edit: Assuming you are, I don't seem to have any trouble with comments before top level functions collapsing.

[edited by - SiCrane on May 31, 2004 6:31:26 PM]

Share this post


Link to post
Share on other sites
Just googled for it, that would be the feature. thanks. Do you know any way to control it so I can manualy prevent or allow code brackets? (or some way to get around it so I can split up my document header (which is not a single code block)

Share this post


Link to post
Share on other sites
In C# at least, you can define your own collapsable / expandable code blocks, called "regions". You create new regions using the #region / #endregion directives. You might be able to accomplish the same thing with Visual C++, but I just checked and it looks like #region isn''t recognized as a directive. I have no idea how to gain a more precise control over the way the IDE manages and automatically generates regions. Perhaps if you sift through the options panels you might find something.

Share this post


Link to post
Share on other sites
Ok, I think I finally figured out what you were asking. It''s a hack, but you can just put an empty anonymous namespace to break up your headers. If there''s a more elegant way, I don''t know what it is.

ex:
#include <cstdio>

namespace {}

#include "myinclude.h"

Share this post


Link to post
Share on other sites
Wow, thanks for all your quick and helpfull replies. Even if I end up using the namespace hack, it will still make my code THAT much more readable, so thanks again.

Richard P. Cesar

Share this post


Link to post
Share on other sites