|
Mike Nordell wrote:
for (int i=...) {}
for (short i=...) {
// guess type of 'i'
}
short
I just checked (and it does what it advertises.)
|
|
|
|
|
ns wrote:
What puzzles me is that the variable i was still holding its final value ...
This is a well known bug in Microsofts compilers, and even in their "latest and greatest" the bug persists, only in a much more evil form:
for (int i=...) {}<br />
for (short i= ...) {<br />
}
There is but one solution to this problem: To the top of every source file wanting to keep scope of for-loop-variables, add
#ifdef _MSC_VER<br />
#define for if(0) {} else for<br />
#endif
|
|
|
|
|
But his snippet has nothing to do with the "well known" bug?! Or am I missing something?
Those who not hear the music think the dancers are mad. [sighist] [Agile Programming]
|
|
|
|
|
peterchen wrote:
But his snippet has nothing to do with the "well known" bug?!
Yes it has.
Or am I missing something?
Yes you are. This is about scoping of for-loop-variables. Once the for-loop is ended (in the example the terminating semicolon), 'i' is no longer valid. Yet, inside the (artificial and superflous) scope; 'i', which is no more (if following international rules, which MS are not), is still accessible from the broken compiler(s).
|
|
|
|
|
Actually, there's a peculiar inconsistancy with the standard. The opening brace of a for loop is essentially considered superfluous and a hidden brace is implied as being before the declaration.
However, in a do loop, the closing brace is NOT considered to be after the while condition. (Frankly, I wish it were, but it isn't.)
Finally, in Visual Studio .NET, you can turn on enforcement of the standard for scopes of for loops (/Zc:forScope) You can also turn off Microsoft extensions.
|
|
|
|
|
Hi,
I'm trying to set up doxygen, and encountered two things I can't figure out:
1) Can I automatically put all sources of one folder (and below) into a documentaiton module? (i.e. without touching every file in the folder)
2) I'm can't figure out how to get the following handling of undocumented members:
- they should be listed in the class overview
- the detailed spec should not contain them
Any doxy wizards around here?
TIA
Peter
Those who not hear the music think the dancers are mad. [sighist] [Agile Programming]
|
|
|
|
|
peterchen wrote:
Can I automatically put all sources of one folder (and below) into a documentaiton module
There's a RECURSIVE flag in the config file that you can turn on. In conjunction with FILE_PATTERNS, you can control what gets processed.
Not quit sure what you mean by #2. If you mean they should appear in the list of public methods but not have a detailed description further down the page, isn't that what happens anyway. I either totally ignore undocumented methods or document them
he he he. I like it in the kitchen! - Marc Clifton (on taking the heat when being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Thanks!
#1) When using the recursive flag, everything is documented at the same level. However, with the following structure:
FooLib\
BarDll\
Appl\
I'd like to have sth. like "Project FooLib", "Project BarLib" etc. as oder criteria. If I udnerstand correctly that's what I can somehow achieve with the \ingroup / \addtogroup / \defgroup identifiers, but I didn't get it working at all.
#2) for the class:
struct CBar
{
void Documented();
void Undocumented();
}
I get the following HTML (rougly):
struct CBar
public methods:
void Documented();
Documented Method
void Undocumented(); (1)
Details:
void Documented()
Documented Method.
This one has been documented
implemented in bar.cpp, line 22
void Undocumented() (2)
implemented in bar.cpp, line 77
I played around, I either have both (1) and (2), or none of them. What I'd like is (1), but not (2).
Part of the project is a large code base with very irregular comments (can't auto-convert into doxygen style). I'd like to progressively touch up the parts I'm working on anyway, but I have no chance to document everything on one run. Yet I'd like to see the member listing, but without the bulky information-free details section.
Those who not hear the music think the dancers are mad. [sighist] [Agile Programming]
|
|
|
|
|
peterchen wrote:
I'd like to have sth. like "Project FooLib", "Project BarLib" etc. as oder criteria.
Trying to do this with Doxygen would be pretty hairy I would create a separate project for each one which is a better solution anyway, IMO. I have a Python script that I run every night which walks our directory tree building MSVC and Doxygen projects. It then creates an index page that links to the output of every Doxygen project that it built.
For #2, there is a way to turn off the detailed entries if you don't explicitly provide any documentation. Look at ALWAYS_DETAILED_SEC although you might need a combination of switches. Otherwise, I suspect it probably can't be done. You could always sumbit a feature request. Or do it yourself
You might want to take a look at DocJet[^] as well. It's not free but it doesn't require tags and does a reasonable sort of a job figuring out what your comments mean.
he he he. I like it in the kitchen! - Marc Clifton (on taking the heat when being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
#1: separate projects was my initial thought, I justed hoped for the added bonus of the projects automatically cross-linked
#2: I played around with the options pretty much, didn't find any. But a feature request sounds like a good idea - once I figured out it really can't be done.
DocJet: I won't get anything "fancy" approved that is >$400, But it sure looks good (and they have a great web site!)
Thanks for your time!
Those who not hear the music think the dancers are mad. [sighist] [Agile Programming]
|
|
|
|
|
peterchen wrote:
I won't get anything "fancy" approved that is >$400,
You could try approaching your boss with the calculation:
my hourly rate * #hours spent faffing around with Doxygen > cost of DocJet.
Never worked for me, though...
he he he. I like it in the kitchen! - Marc Clifton (on taking the heat when being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Hello,
I am writing an SDI app which uses the IE CHTMLEditView class new to MFC 7.0.
From my main application window I am opening a second CFrameWnd with a new CHTMLEditView view. In this new window class I am attempting to populate the view, as follows:
//this runs after the new window is created.
void CNewMsgFrame::SetMsg(CString pString)
{
MessageBox("Hello!!!!");
CHTMLEdDoc* pDoc = (CHTMLEdDoc*)GetActiveDocument();
//pDoc->m_pHTMLView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
//pDoc->m_pHTMLView->ShowWindow(SW_SHOW);
//SetActiveView(pDoc->m_pHTMLView);
//pDoc->m_pHTMLView->SetWindowText(pString);
pDoc->m_pHTMLView->SetDocumentHTML(pString);
RecalcLayout();
}
I want to show an HTML page in the view (m_pHTMLView), and am using the SetDocumentHTML() method to load the HTML. However I find that the view remains blank. The only way I can get it to show the page is to include a MessageBox in the code: after the messagebox is shown, m_pHTMLView somehow rights itself, and displays the page properly! I find this very curious. Somehow using the messagebox seems to ensure that the new view is initialised properly: without that I must be leaving out some necessary code.
I would be grateful to know if someone can spot what code is left out, which is needed to make SetDocumentHTML() work correctly. (The commented bits of code are things I tried to make the code work, but which didn't help....)
Thanks,
Paul Trimming
|
|
|
|
|
Paul,
It sounds like your SetMsg() function is called before the new FrameWindow/View is visible. I'm not using MFC7, but there are examples for VC6 which show how to use CHTMLView, which I assume is a subset of CHTMLEditView. One example is MFCIE. I'm using CHMTLView plus extra MSHTML editing stuff in a new app without any problems. Hope that helps.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Thanks Neville, after a bit of experimenting it turned out that you were right. The problem was that InitialUpdate wasn't updating the view. I used a routine that occurs later in the process, and then all was OK.
Thanks,
Paul Trimming
|
|
|
|
|
Hi
I have a CStringArray containing a list of a few files from directory. Now I want to search the array for a specific file, thats the way I do:
for(int i=0; i<arMaps.GetSize(); i++)
{
if(!stricmp(arMaps.GetAt(i), "test.txt"))
return;
}
But the file is not found, why? It definately exists.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
How did you obtain the information that is stored in the array? Could the strings in the array be the full path, not just the filename and extension?
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
No, it is only the filename without any path in the array. I have checked it in the debugger as well :/
modified 12-Sep-18 21:01pm.
|
|
|
|
|
A quick peek at the help tells us that GetAt(int) returns a char. Pretty good chance it does not return a pointer to a string of characters.
If instead of using the runtime function of stricmp(), you had tried to use the CompareNoCase() method of the CString class, you likely would have avoided this error.
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.
|
|
|
|
|
No, I found the problem: The files in the array have no extension, dunno why I have overseen this :/
Now it works with stricmp as well.
thanks anyway both of you for the help
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I have a menu item called " THis is the same as pressing Button A" . So I want it to run button A's OnButtonA() when its pressed.
COnversely, if I have a button B and want to trigger the OnMenuItemX() handler which just has a messagebox in it, how do I do this?
Thanks
Appreciate your help,
ns
|
|
|
|
|
Just give the menu item and the button the same ID.
--Mike--
I'm bored... Episode I bored.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Just add a function that does the work, say do_that_thing_you_do , and call it from inside both the handlers.
OnButtonA () {
do_that_thing_you_do ();
}
OnMenuItemX () {
do_that_thing_you_do ();
}
do_that_thing_you_do () {
}
cheers,
-B
|
|
|
|
|
I get it! Many thanks!
Appreciate your help,
ns
|
|
|
|
|
SO I have a menu item that when clicked, runs a function OnMenuA(). WHen I click another menu item, I want to run the function that was triggered by pressing on the first menu item
Appreciate your help,
ns
|
|
|
|
|
You just do the same thing you did for the first menu.
ON_COMMAND( FIRST_MENU_ITEM, OnMenuA )
ON_COMMAND( OTHER_MENU_ITEM, OnMenuA )
Or did I miss something obvious ?
Max.
|
|
|
|