|
caulsonchua wrote: i had write a code in C, but when execute, it an error. Is this supposed to be helpful? Be specific. What error? What is the code supposed to do (I know it's a linked list, so don't play that card)? What is it doing instead? Have you used the debugger to step through the code?
caulsonchua wrote: May i know how to combine a correct structure ? What structure are you trying to combine?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
MCU program, no cache, can anybody explain the performance comparison between global and local variables?
|
|
|
|
|
Your question is far from clear; does it have anything to do with C/C++/MFC?
Veni, vidi, abiit domum
|
|
|
|
|
I just not very clear which way is better in programming a C program, that will run on a 32 bit RISC Microcontroller platform.
Using globals or using locals as possible as many.
|
|
|
|
|
as I understand, local in stack, and possibly replaced by register.
but local variable needs push/pop operation.
Globals in RAM, no need to allocate memory/retrieve memory every time
|
|
|
|
|
Given the speed of most modern processors the time difference will most likely be too small to measure.
Veni, vidi, abiit domum
|
|
|
|
|
It depends on the architecture and how quickly the processor can form an address in comparison to how fast an instruction gets through the pipeline. The only way you're going to know for sure is to measure the speed of your app using both types of variables.
|
|
|
|
|
If a code block locates in an infinite loop, choose locals, then with locality principle, it is better than globals, I think.
If a code blcck just run a few times, accessing global vs push/pop stack operation, which one is better?
|
|
|
|
|
I'm trying to add a dynamic status icon to a CMFCRibbonStatusBar. I've followed the "standard" approach of creating a CMFCRibbonButtonsGroup, loading the images, then creating a CMFCRibbonButton (with no icon), adding it to the button group and then using SetImageIndex.
This works fine, and I can dynamically set the icon, however I am getting a frame around the button rather than just the icon. Hopefully this screenshot of the status bar explains what I mean better than my description: screengrab
I've tried everything I can think of and can't get the frame to go away, so I'm open to suggestions! The code from within my CMainFrame is as follows:
m_tbiStatusImages = new CMFCToolBarImages;
m_tbiStatusImages->SetImageSize(CSize(16, 16));
m_tbiStatusImages->Load(IDB_STATUS_SMALL);
m_rbgMicrowaveIcon = new CMFCRibbonButtonsGroup;
m_rbgMicrowaveIcon->SetImages(m_tbiStatusImages, m_tbiStatusImages, m_tbiStatusImages);
m_rbMicrowaveIcon = new CMFCRibbonButton(ID_STATUSBAR_MICROWAVE_ICON, _T("Microwave Status"), -1, -1);
m_rbgMicrowaveIcon->AddButton(m_rbMicrowaveIcon);
m_wndStatusBar.AddElement(m_rbgMicrowaveIcon, _T("Microwave Status"));
m_rbMicrowaveIcon->SetImageIndex(0, FALSE);
|
|
|
|
|
Hello Friends
I am looking for Graphics Library which helps me in Converting a Raster Image to vector Geometry.
I tried OpenCV but Results are not that Good as I expected. I used FindContours Algo,canny,Sobel using openCV libraries but the Vector Info that I get is not satisfied.
So, I am looking for an another Graphics Library which can help me out in Finding Vector of a raster image.
Thanks In Advance.
Regards
Yogesh Sikri
|
|
|
|
|
Potrace is probably the leading library, though for commercial releases, you have to negotiate a royalty agreement: http://potrace.sourceforge.net/[^]
(If there are alternatives to Potrace that are as, or more, capable, I'd sure like to know.)
|
|
|
|
|
Thanks Joe for your Reply.
But, I want to know that Will this Library works well on Pictures taken from Camera. As I am not working with Images created in Computer.
Let me know.
Regards
Yogesh Sikri
|
|
|
|
|
It will, though I don't know how well. It's free to try.
|
|
|
|
|
Dear Experts,
In one project, I sometimes have to reset the TAPI Service when I find network cable is disconnected and connected.
I know I could get TAPI process ID in VC2005 by using EnumServicesStatusEx function.
But because my code is in VC2000, I have to get it in VC2000.
I find a code snippet which use CreateToolhelp32Snapshot and Process32Next to find process IDs in VC2000.
But it gives me several svchost.exe which only one belongs to TAPI service.
My question is : how I could find TAPI service Process ID in VC2000.
Regards
Mahdi
|
|
|
|
|
What is VC2000?
Veni, vidi, abiit domum
|
|
|
|
|
string laceStrings(const string& s1, const string& s2)
{
if (s1.empty())
return s2;
if (s2.empty())
return s1;
string laced;
laced.resize(s1.size() + s2.size());
int i = 0, pos = 0;
int size = std::min(s1.size(), s2.size());
for ( ; i < size; ++i)
{
laced[pos++] = s1[i];
laced[pos++] = s2[i];
}
if (s1.size() >= s2.size())
for ( ; i < s1.size(); ++i)
laced[pos++] = s1[i];
else
for ( ; i < s2.size(); ++i)
laced[pos++] = s2[i];
return laced;
}
PLEASE CONVERT İT TO PYTHON
|
|
|
|
|
Write it in idiomatic C++ (using boost) and if you know any Python at all it'll click straight away.
|
|
|
|
|
Hello all,
I wanted to hear your opinion whether C++ has a future.
I think the answer is kinda complex.
Will the Desktop itself be available in the future?
Or will programs (i.e. instructions) and data be streamed from the cloud to a lightweight "terminal" (similar to Google Chrombook)and hence replacing our familiar desktops of today?
Hence will C++ be even needed in that case?
Or will something else, say Java, be running everything around?
Thank you for your responses.
Hadi
|
|
|
|
|
Will Chelsea win the cup? Will my nephew win "Britain's Got Talent"? Will Hell freeze over? This forum is for technical questions, we cannot foretell the future any more than you can.
Veni, vidi, abiit domum
|
|
|
|
|
It has a future - I was first told in 1995 that I wouldn't have a job next year writing C++ applications and I'm still at it. Sun couldn't sell Java stations in the 1990s and even though I use a Chromebook [1] almost exclusively at home high performance apps on them usually have a chunk written in C++.
I can't see anything replacing C++ (apart perhaps for C) in the embedded or OS spheres either.
|
|
|
|
|
I would have added "also high performance graphics" too, but that is not true anymore with CUDA/OpenCL having language binding to Java/Python etc.
But yeah, OS, device drivers, embedded markets are still the domains for C/C++.
|
|
|
|
|
My opinion is that C++ looks ahead for a long future. C/C++ has probably the largest opensource codebase and set of libraries available (this is very important!!!) and most of the popular operating systems has been written in this language. (I'm a bit sad that some things can't be changed in C/C++ because of backward compatibility problems...) C/C++ is probably the "most portable" language across current popular platforms (Windows,Linux,Android,iOS,MacOSX,...) - try to run java on iOS... Even the android based java is a nonstandard one. Java and C/C++ are very different in many aspects, there are fields where they are simply not competing because either only Java or only C/C++ is the good choice. A serious programmer has to know C/C++ because currently "half of the world" has been written in this language and besides this you have to know many other languages anyway even if you don't actively using them.
Your question is often the concern of newbies. They are afraid of investing their time in learning something because they are afraid of "putting up everything on learning a specific language". It is not the knowledge of a language that is valuable in a programmer. You can learn programming, program design and/or a paradigm by learning any of todays langauges. Being a good valuable programmer has nothing to do with knowing a specific programming language.
|
|
|
|
|
You hit the point Sir.
I'm not exactly a newbie, I'd say I'm intermediate in C++.
Yet I had hard times finding a job as a C++ developer in Quebec, so I became very hesitant, is it because of the difference in mentality or is it because C++ is becoming unwanted or more like a "niche".
Hence I wanted to know whether it still is a viable option and worth my time and efforts, otherwise I'd switch to something else be it Java, .NET, Android, whatever.
Thank you for your response.
|
|
|
|
|
You don't have to "switch", you can learn both. Try java too. Currently I'm working with C++ but worked with java for many years. The java language is extremely simple, not comparable to the complexity of C/C++. In case of java the hard work is rather learning the standard library and optionally j2ee related libs and a few opensource frameworks used by companies.
|
|
|
|
|
30 years ago I started working with C, then C++, then Pascal (Delphi, actually), then back to C++, a bit of Java, and in the meantime I'm back to C++ again.
C++, while old, is not going to be replaced or retired any time soon. It may however be less prominently presented in press, or job offers, because fluctuation tends to be lower with developers in older, established languages - at least that is my experience.
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|