|
It's speeding up your code-development process.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Probably continuously updating and verifying Intellisense[^]
Best Wishes,
-David Delaune
|
|
|
|
|
time might come for hardware update
|
|
|
|
|
followait wrote: It's slow
Dump it and use Eclipse and stop complaining
led mike
|
|
|
|
|
I'm not complaining.
I'm thinking about the design.
|
|
|
|
|
followait wrote: I'm thinking about the design.
Excellent. You should apply for a position on the VS team. I'm sure they would snap you up!
led mike
|
|
|
|
|
Can Any one explain what is alpha in image processing (particular in DICOM IMAGES)
|
|
|
|
|
|
Did you get a job doing image processing on medical imagery??
|
|
|
|
|
I had two cpp file, there i one common .h included file to both of them. appart from their respective .h files
so I declard a variable in the common .h file, so that I can access it from the both the cpp files..
is there a better OO way
|
|
|
|
|
ptr_Electron wrote: is there a better OO way
yes. use a public static member of a class...
|
|
|
|
|
If you wish to use a global variable the correct way is.
1. Define it in one of your source (*.cpp) files.
2. Declare it as extern in the other source files.
for instance:
file foo1.cpp
int iGlobal;
file foo2.cpp, foo3.cpp, foo4.cpp, ...
(alternatively you may include the following declaration inside a header file, included by all the above sources)
extern int iGlobal;
IMHO global varibles are not evil, anyway you should use it sparingly. OOP offers some techniques to avoid typical global variables issues (like name clashes, arbitray access...).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Thanks for your responce, but it just flashes following...
warning LNK4006: "int ::nFuncEqu" (?nFuncEqu@ @@3HA) already defined in stdafx.obj; second definition ignored
and
error LNK2005: "int ::nFuncEqu" (?nFuncEqu@ @@3HA) already defined in StdAfx.obj
|
|
|
|
|
Could you please post the relevant code (i.e. where variable is referenced, both declarations and definitions)?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
mainly used .h file included in most of the files
int nFuncEqu;
using File1 // modiying the value in this file
extern int nFuncEqu;
using File2 // using the value in this file
extern int nFuncEqu;
All the abov things are not with in any class
|
|
|
|
|
[added]
here [^] it is explained very well.
[/added]
ptr_Electron wrote: mainly used .h file included in most of the files
int nFuncEqu;
change to
extern int nFuncEqu;
ptr_Electron wrote: using File1 // modiying the value in this file
extern int nFuncEqu;
change to:
int nFuncEqu; (and you don't need to include the header file there).
ptr_Electron wrote: using File2 // using the value in this file
extern int nFuncEqu;
if you include the header file then remove the declaration. On the other hand, if you don't include the header file, leave the declaration as it stands.
The rule for extern declarations is:
you must declare your variable as int nFuncEqu only inside one source file (i.e. .cpp ) while declaring it extern int nFuncEqu in all other source files. Including the header (containing extern int nFuncEqu ) is simply a shortcut for all those extern declarations.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
modified on Friday, March 28, 2008 11:13 AM
|
|
|
|
|
I made it as static, it is compiling , i modified the value form one file, and it was not reflecting when I am accessing if from the other file, it was not modified inbetween… it remains zero,
|
|
|
|
|
Can you tell me the reason you're always doing the exact opposite of what I suggested?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Well, I made it excatly what as you told, but the change did not refelected in the other file
and I made static,
|
|
|
|
|
Don't make it static.
Other people suggested to make it static member of a class, not to do a static variable declaration. Static variable declaration make the variable itself having file-scope, i.e. it is visible only inside the file wherein it was declared.
I repeat, if you want to use a global variable:
(1) declare it inside you header file as extern int .
(2) declare it inside one source file as int .
(3) include the header file inside all source files.
Hope that helps.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
It worked,,, thank you
|
|
|
|
|
ptr_Electron wrote: It worked
Finally!
ptr_Electron wrote: thank you
You're welcome.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CPallini wrote: IMHO global varibles are not evil
IMHO they are, unless they are constants
|
|
|
|
|
Well, the overall size of the project has a role in.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
IMHO it has little to do with const-ness, much more to do with the question.
Is what is it represents really and justifiably process global?
Because you can only very seldom honestly answer yes to that question, e.g. definition of stdout or value of WIN_VER then you shouldn't have many globals. Most of them will probably end up being constants but that's just down to the relatively stable nature of the universe in relation to software lifecycles
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|