|
|
What is the format of the FAT of a file and a disk?
How to access the FAT using Visual C++?
Thanks.
Maer
|
|
|
|
|
I want to know why the results of debug version and release version are not
identical when using VC++? (My program has no memory leak.)
who can give me some advice,thanks a lot!;P
|
|
|
|
|
There are LOTS of differences between release and debug versions. You need to give more information if you want help fixing a problem. Also there are articles here on release vs debug versions.
|
|
|
|
|
I set 4 level-warning in project settings,and I am sure that all
the variables are initialized,but some results aren't the same
slightly,for instance:"Waist=75.620499,Knee=36.650490 "in release version and "Waist=75.630901,Knee=37.181105" in debug version.I suspect if the problems consist in float type,thanks for any further help.
|
|
|
|
|
you might want to try a tool like BoundsChecker or Purify. the compiler, even at level 4, doesn't catch everything.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
I have recently been asked to code a function to reverse a single linked list. The code that I provided is the next:
void Reverse(Link *pList) {
Link *pH = NULL;
Link *pT = pList;
while (pList) {
pList = pList->Next;
pT->Next = pH; pH = pT; pT = pList;
}
pList = pH;
}
I didn't use any data structure (like a stack) to reverse the list because I been said that it should save memory and be very efficient.
Well, after showing my code and being reviewed I have been notified that the code works well but it shows a pretty basic skills in C++
I would like to know your opinion about it. Is there a more efficient code to reverse a single linked list? Do you agree in the fact that it shows very basic level of C++?
I have been coding in C++ for 7 years and I have been evaluated before in C++ coding with a very high scores. I am just wondering if am I missing something?
Thank you guys
|
|
|
|
|
I would say that it's true, in the sense that it's probably not using any techniques that are *not* basic, but I would say it's unfair to make such a review. The question is, does it do what it is supposed to do, and can the reviewer suggest a better way of doing things ? I can think of no better way of reversing a singly linked list than to iterate through it as you have done. In fact, by definition, there is no other was TO iterate through it.
If you're really upset about it, why not look at how STL impliments a reverse algorithm for a list ? If the review means something then it could be worthwhile presenting examples, assuming the STL doesn't do it in a cunning way that escapes me and results in a better reverse ? I don't see what else they could do though.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I would say that it's the most efficient code for reversing a linked list that I have ever seen.
|
|
|
|
|
Looks like the MS's interview question =) If you have said that this is very basic code for such a skilled C++'er you should give them something like this (it's a recursive approach)
void RecursiveReverse(List **pList)
{
if( (*pList) == NULL || (*pList)->Next == NULL )
return;
List *pOldNext = (*pList)->Next;
RecursiveReverse(&pOldNext);
(*pList)->Next->Next = *pList;
(*pList)->Next = NULL;
(*pList)= pOldNext;
}
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor@soukhov.com | ICQ:57404554 | http://soukhov.com
|
|
|
|
|
Given today's definition of "efficient" (i.e. fast), recursive implementations are by nature inefficient, since each recursive call requires the creation and destruction of a stack frame. However, a recursive solution may be still be valid if it's easier to understand and maintain.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi Ravi !
I've a look thru all this topic and found no definition of "efficiency" as the "speed". Of course it's quite common definition - but not for this case. I know that my code most probably will be a slower (yeah - I know how the recursive technics works) than the original - but this code may be more efficeint for a size of code =) and definitely more "elegant" =)
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor@soukhov.com | ICQ:57404554 | http://soukhov.com
|
|
|
|
|
привет Igor,
I agree it's more elegant and therefore more appealing. The problem about efficiency is that one has to determine how the code will be used. If the list reversal would be done infrequently, a recursive and interative solution would work equally. However, if the reversal was being done in a loop, we'd be better off with a an interative approach.
In my experience, a decision to suggest a code change during a code review hinges on these factors (I'm sure there are more), in descending order of importance:
- Is the code clear and easy to maintain?
- Can it be made to run faster?
- Can it be used to take less space?
Cheers,
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi Ravi (surfed all the net to find out how it should be in Hindi and doesn't found any wroking online English->Hindi translator =).
I'm 100% agree with you that that code is only looks great - in real practice I'd better use something more easy to understand and therefore to maintain.
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor@soukhov.com | ICQ:57404554 | http://soukhov.com
|
|
|
|
|
...and of course,
- Is the code correct?
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
|
Thank you Igor for your response.
In my original post, I was saying that I didn't use any data structure like the stack because it's supposed to save memory and be efficient (for efficient code, my personal view is that it solves the problem in less cycles of the processor in question, and saves as many resources as it can).
Your code is very elegant and effcient (from my own perspective), but I'm affraid that it would be rejected anyway based on the fact that it is using the system's stack for the recursion (Alas, a data structure), and dereferencing the double pointer takes some more time than dereferencing a single pointer.
I could imagine that this will be the response from the person who asked me to do such a function.
Just to be fair, I had requested to code another function related to binary trees, and guess what? I used recursion but had the same feedback
|
|
|
|
|
Don't waste your time with the person who rejects these "classic" solutions.
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor@soukhov.com | ICQ:57404554 | http://soukhov.com
|
|
|
|
|
Hello,
I'm writing the specs for my next project (well not really, I'm going through them in my head ), and I'm curious. Does anyone here know how to compile a dialog (or window) at runtime to an exe?
The project I'm considering writing is an autoplay type thingie (like demoshield(TM)). However, I'm lost as to how I would be able to compile an exe from a project file and have it work at runtime without an INI file or something.
Just looking for guidance, not necessarily code.
As always, thanks.
Frank
|
|
|
|
|
The MSDN has a code snippet on how to create a dialog template - I used it the other day because we're writing a GUI library exposed through a Python console. Is that what you mean ?
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
|
The MSDN sample is called DLGTEMPL, you can get it from msdn.microsoft.com if you don't have msdn on your PC. I'd post some code for you, but it's Saturday morning and it's all at work
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Howdy all,
I've been stumped on something for a while now. I've got a CEdit subclass that I'm writing to change all sorts of nifty colors, but I can't seem to change the color (usually blue) that gets drawn as the background for text that gets highlighted. I've tried setting a breakpoint in the OnChildNotify function (which as I understand gets ALL messages) but it doesn't even trigger when I highlight text. Is changing the behavior something that I'm unable to do (maybe it's internal to windows)? Any ideas - if nothing else I'd just like to get to the bottom of it and satisfy my curious mind...
Thanks,
Dave
|
|
|
|
|
I think you want COLOR_HIGHLIGHT. This is a global setting so would have to be careful to reset it when finished. GetSysColor/SetSysColor
|
|
|
|
|
Hi Every one...
In debug Mode my application compiles properly and give
perfect out put.
But when i try to compile it in Relese Mode , It gives
Linking error.
Specified as below.
/////
error LNK2001: unresolved external symbol "char const *
const _afxPchNil" (?_afxPchNil@@3PBDB)
fatal error LNK1120: 1 unresolved externals
///
Can neone guide me for the same ..
Thanks in advance
Stago
|
|
|
|