|
Yes, it is valid if it is given in Correct manour
&pSourceStr -> it gives address of the pSourceStr
And
*&pSourceStr -> it gives Data on that address.
|
|
|
|
|
Yes it is legal, this is how it breaks down, assuming the function was static just for example's sake
LPCTSTR pStr = _T("SomeString");
const XStr Source = _T("SomeSuperString");
const XStr* pSourceStr = &Source;
bool bResult = CMyClass::MyFunction( pStr, pSourceStr );
//pSourceStr may have been modified by the call but Source will still be the same
The function takes a pointer-by-reference, that is a reference to a pointer, as its second parameter. What this means to the caller is that when the function returns pSourceStr might have changed, it might point somewhere else now, but Source will not have.
This is usually done to get, in effect, a second return value from the function. The function will modify pSourceStr in order to communicate it back to the caller along with the bool result.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Cristal clear, thanks Matthew !
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverb
|
|
|
|
|
Rage wrote: What is the idea behind ?
Without knowing all the relevant analysis information it is not possible to say with any certainty, but it very likely means a design flaw.
|
|
|
|
|
Hi All,
I like to learn Debugging tools.
Can any one send some links which r useful for me
Thx a lot..
|
|
|
|
|
MSDN is one option
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
sheshidar wrote: I like to learn Debugging tools.
Can any one send some links which r useful for me
which debugging tool you want to learn, friend. there are many, but best one is Visual Studio itself. just put breakpoint in source code and debugged the application.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
And compile with which key?(F10 or F11)
|
|
|
|
|
Hamid. wrote: And compile with which key?(F10 or F11)
and you forget F5
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Oh yes
|
|
|
|
|
Hello everyone,
Suppose I have two enums which has an item with the same names -- but different values,
<br />
enum foo {<br />
<br />
NAME = 100;<br />
}<br />
<br />
enum goo {<br />
<br />
NAME = 200;<br />
}<br />
Are there any ways to specify whether I need to access NAME in foo or NAME in goo?
thanks in advance,
George
|
|
|
|
|
There is not! It appears to me to be a scheme designed to confuse both the Compiler and the developer.My advice: Don't!
LateNightsInNewry
|
|
|
|
|
Hi LateNightsInNewry,
Could you show me how to solve this issue in your ideas by simple sample please?
regards,
George
|
|
|
|
|
The Problem is, you have two enum values by the same name. If the compiler is instructed correctly it should throw an error! You managed to compile it regardless!
That did not mean that it was the right thing to do to get your code to compile!
The Bottom Line is, You wrote daft code, and spent time to convince the compiler that it was wrong to issue error messages about it. You managed to convince it, so it issued a daft environment to the compiler. The way you did it is probably by having a project spread out over several folders, and having different versions of a header file in each folder!
The Simple Solution is:
1. If the enum values are meant to represent the same condition, include it's definition in an Header file visible everywere required. i.e. construct a Common Header Directory, and instruct the compiler to search that folder preferentially.
2. If the enum values represent different conditions, give them different names
3. Learn that NameSpace Collision Error Messages are your friend. It is your Indicator that things are wrong, and you catch it when it occurs! Imagine debugging an App where all variables have the same name!
4. Realise that the Names of Objects only come into play at Development Level, and that there is no reason to be coy about naming. There is absolutely No possibility of recovering te name of a correctly compiled and linked retail version of your code from the executable.
Hope this is Helpfull,
Bram van Kampen
|
|
|
|
|
Thanks for your great reply Bram!
regards,
George
|
|
|
|
|
The short answer is no because the names exist in the same scope and same namespace. You could do
<br />
class Cfoo<br />
{<br />
<br />
enum foo <br />
{<br />
NAME = 100;<br />
}<br />
};<br />
<br />
class cGoo<br />
{<br />
enum goo <br />
{<br />
NAME = 200;<br />
}<br />
};<br />
which would then allow Cfoo::NAME to be differentiated from Cgoo::NAME or
<br />
namespace nsfoo<br />
{<br />
enum foo <br />
{<br />
NAME = 100;<br />
}<br />
}<br />
<br />
enum goo <br />
{<br />
NAME = 200;<br />
}<br />
which would differentiate nsfoo::NAME from NAME. I would strongly prefer the class method because namespace resolution is relative.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Thanks Matthew!
A great sample! Cool!
have a good weekend,
George
|
|
|
|
|
Hi,
I've been doing some work using C# and like the auto document format (Under the Edit->Advanced Menu).
But noticed that this feature doesn't exist in C/C++!! Anybody know if there is an Add-In that I can use within VS2005?
Many thanks
Gibbo
|
|
|
|
|
What does the "auto document format" do? I mean... What do you want to have?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
The "Auto document format", goes through and re-formats your code according to a set of rules..
For example if you had the following code:
void TestFunction ( const char *var1)
{
if (1 == 1)
{
int i = 0;
}
}
and reformats it
void
TestFunction(
const char *var1
) {
if(1==1){
int i = 0;
}
}
That sort of thing..
Gibbo
|
|
|
|
|
Personally, I prefer the first option (specially with one tab in every scope)
Like:
void TestFunction ( const char *var1)
{
if (1 == 1)
{ int i = 0;
}
if (i == 2)
return;
}
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
I've just checked both VS71 and VS2005 and it does exist!
Under Edit->Advanced->Format Selection
I Dream of Absolute Zero
|
|
|
|
|
I know, it is only available for C#/VB/etc, not C/C++.
I'm looking for alternative for C/C++ that will go through and format my code..
Any ideas?
|
|
|
|
|
no. no. I am using C++...and its there!
I don't know whether the installation version makes any difference. I have the Professional install.
I Dream of Absolute Zero
|
|
|
|
|
Hello everyone,
I am using Visual Studio 2005 to develop C++ DLL (in-process COM). There is a setting in Linker --> Input called Module definition file. This setting makes me confused,
1. I have tried that if input a file name (.def), then the generated DLL be larger than the time when we leave the module definition file to empty. Should we leave it empty or non-empty (input a .def file name);
2. What is the function of the module definition file? Should developer write it manually or generated by system.
thanks in advance,
George
|
|
|
|