|
I always thought breakpoints were disabled in release mode.
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
How have you got the debugging session configured?
I assume you have the DLL as the loaded project in VC and are using the exe as the "Executable for debug session".
This should work providing you have the dll compiled with the debug info.
Michael
|
|
|
|
|
Well I gave up trying to figure out why my application wouldn't break, so just made a new project and copied all my exisiting code into it. Everything seems to work fine. One thing that I did change is the DLL name. I had wanted a specific name so I renamed the dll. The new project is named the same as the dll and this works fine. I am curious if this is a known issue because with another dll, it is being renamed as well and I can't set bp's in it either....
Cheers
|
|
|
|
|
which one is "better"?
i know bool is more standardized but BOOL is more efficient, but which one is more commonly used, furthermore, which one should i use?
>>Roman<<
|
|
|
|
|
You answered your question. I think that is better to use the more efficient...
Do you prefer to use while(true) or for(;;) ?
Regards!!!
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
while(true) and for(...) take the same amount of time. I have yet to see a compiler not optimize while (true) away.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Is bool less efficient? I don't think so...
I usually use bool for pure C++ logic, and BOOL for UI/Win API related stuff.
I have seen a lot of people mixing them and IMHO is not a good idea in terms of readability.
|
|
|
|
|
BOOL edges out bool in performance just by a very tiny amount.
Here are the rules I use.
If I am doing WIN32 code, I use BOOL. Otherwise, for the other 90% of my code, I use bool.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Hi!
Try this:
bool test_a = 3;
BOOL test_b = 3;
or that one:
bool test_a = true;
switch(test_b)
{
case 4:
break;
case 5:
break;
}
and the same for BOOL.
You will see the difference
Moreover: sizeof(BOOL) != sizeof(bool) ===> 4 != 1
I use always bool's, but when I deal with Win32 - I use BOOL's.
Mukkie
|
|
|
|
|
thanks, so for libraries i make, ill use bool if they're not windows-specific ;D
>>Roman<<
|
|
|
|
|
frst of all, thanks to Bill Wilson for answering my naming conventions post
i realized that many of my classes have Get/Set members for very simple variables like integers or such. it's very annoying to manage these functions as the member variables change data type and name a lot throughout my coding process.
is it good practice to make the member variables just public (and not have "m_" precede them) or is there some easy way to manaage Get/Set functions?
also, if public member variables is the way to go, i'd like to have a pointer class to manage dynamic memory and stuff like that.. sort of like a smart pointer... is there an already existing class that would allow for that or do iu have to make one?
p.s. i tried auto_ptr but it seems that that class only sets the pointer in its constructor
>>Roman<<
|
|
|
|
|
RomanNY wrote:
is it good practice to make the member variables just public
NO!!!
I vote pro drink
|
|
|
|
|
well is there a tool to manage the get/set functions then? im using VC++ 6
>>Roman<<
|
|
|
|
|
Yes, there is a big window where you will find your class definition. Add Get/Set methods there as appropriate.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
|
|
|
|
|
RomanNY wrote:
well is there a tool to manage the get/set functions then? im using VC++ 6
A keyboard ?
|
|
|
|
|
|
I Agree with you...
I say NNNNNNNOOOOOOOO
Also I vote pro drink
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Everone shouts "NO!!" to your question. I'd agree with them, but thought it'd be useful to explain why...
Imagine you've written your class with public members, and for example, you had a char * pointer as a member. Your app is free to both read & write to this pointer as needed.
As your app grows, you want to make it more efficient. So you go multi threaded. You could now get yourself into a situation where one thread is in the middle of reading data from that pointer, but a totally different thread is trying to write!. At best, you get data corruption. At worse, you get a protection error.
If you'd religiously used accessors and mutators, it would be minimal work to prevent this happening. You'd make sure that your accessor and mutator member functions used mutexes (or some other sync object, as appropriate) to police access to the member variable.
The other main reason is readability. Imagine these two lines, which are functionally equivalent:
class CYourClass
{
public:
char *m_pBuffer;
}
....
CYourClass *p_YC = new CYourClass
char mystring[]="hello world";
p_YC->m_pBuffer = new char[strlen(mystring)];
strcpy(p_YC->m_pBuffer, (char *) mystring);
p_YC->SetBuffer( (char *) mystring);
in that example, you could do clever stuff like having the SetBuffer() mutator handle things like memory allocation for m_pBuffer. It simplifies your code.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Readability is not the only benefit to encapsulation. The primary reason, in my opinion, is to divorce the audience of a member variable from the derivation of its value.
If you use accesor and mutator methods you can do things like changing the underlying storage or even add qualifications and calculations without impacting the audience of the value.
For example:
Say you have an inventory class that contains a Price variable. Then at a later date, after you've built your app, a buisiness decision is made to vary the price by warehouse location. If you used an accesor (GetPrice), you only need to modify it to accomodate the calculation, rather than modifying every reference to m_price in the entire app.
Just my opinion for what its worth,
Bill
|
|
|
|
|
well i dont plan on storing pointers as member variables, i plan to make classes to control the pointers. the only simple member variables would be maybe integers or such...
e.g.
class MyClass
{
public:
SmartPointer<char> pBuffer;
int nType;
MyClass();
};
i see the problem with this though, that there can be no validation but the pointer thing shouldnt be a problem as long as auto_ptr or another smart pointer template class is used
>>Roman<<
|
|
|
|
|
One very crucial aspect of doing Object oriented programming is the concept of data encapsulation. If your member variables are public they are not encapsulated. Making them public out of convenience starts a process of laziness which ends with every declared object made public to the entire application and every member of every object is therefore a global public variable. This defeats the entire purpose of OO design.
I have sadly been required to work on many applications which fell victem to this very process. Don't do it. Please.
Take the time to properly encapsulate and manage your data. The time you will ultimately save yourself and others (like me) will be well worth the extra effort upfront.
"There's a slew of slip 'twixt cup and lip"
|
|
|
|
|
I would like to know if there is a way to open picture files other than tga's, bitmaps or jpegs, and how to do it, and to open 3d scene files for truespace, as i do not know milkshape 3d, which seems to be so common.
==================================================
When Your Mind Wonders...Where Does It Go???
|
|
|
|
|
Does anyone know how to create one of those? I see them in many places besides the common file open dialog, so i assume it's common code from somewhere...
-c
Smaller Animals Software, Inc.
You're the icing - on the cake - on the table - at my wake. Modest Mouse
|
|
|
|
|
|
any other hints...?
this:
#include "Shlwapi.h"
...
SHAutoComplete(m_hWnd, SHACF_FILESYSTEM);
gives me an 'SHAutoComplete' : undeclared identifier . searching the windows headers for SHAutoComplete turns up 0 matches.
is it some kind of platform SDK thing?
-c
Smaller Animals Software, Inc.
You're the icing - on the cake - on the table - at my wake. Modest Mouse
|
|
|
|