|
ThatsAlok wrote:
VisualCalc.
I love that Calculator
really ?!
wowwwwwww, you congrats me so much... the first guy that tell me my calculator's more than useful, but great !!!
you got my 5 !!!
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
really ?!
Yeap,I gather some programing logic from there
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
|
Bob Stanneveld wrote:
Are you going to post it here on CP? I would like too see your article!
I don't know. I'm doing this for my engineer diploma and the project was given to me by a company so I guess it's theirs once I finish it. But if I'll decide not to work for them, I'll post it.
I just figured out that I need only to extract the classes' names to know that them are user defined data, the #define and #typedef, and the functions' names.
After that I can work on every function individualy.
As a matter of fact the project is supposed to take two functions, construct the decision tabels for them and see if they are logigally identical.
|
|
|
|
|
marius-adrian wrote:
I guess it's theirs
Don't guess, find out.
Are they paying you anything ?
The tigress is here
|
|
|
|
|
Trollslayer wrote:
Are they paying you anything ?
Nope. They have somekind of agreement with our teachers and because of that the students were given some projects from that company.
|
|
|
|
|
So the company gets the benefit, the teachers get something and you do the work ?
Make sure you have copyright !
The tigress is here
|
|
|
|
|
The parser is only a part of the entire project and I don't have enough time left to make one.
I just need one that will know which statement is an if/for/while/switch/goto/label, to detect the functions, functions calls, return etc. I just need to know the structure of the program not to make the calculations and the operations. Or to make me the AST.
Thanks.
|
|
|
|
|
Hi All,
In an ActiveX dll, I have created UI and worker thread. But I am not able to allocate dynamic memory using "new" operator in worker thread. It allocates 500 bytes successfully but fails for more than 1000 byte.
Can any one tell me why this might be happening?
Thanks,
Amit.
|
|
|
|
|
Is your code using TerminateThread(...) anywhere? I learned the hard way some time ago how that kills your processes address space (due to the thread's stack address space not being made available again).
See what error code is being set (GetLastError() ) right after the allocation fails.
Does malloc(...) fail as well? What about other dynamic allocation functions?
Lastly, try using the debug CRT heap functions to verify that none of the heap structures have been stepped on (due to a memory over/under-run), like _CrtCheckMemory(...) .
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hi James,
Thanks for the reply,
I have already tried it with malloc, malloc works fine until I allocate 975 bytes, but when I exceed that limit; it fails.
Moreover the application crashes, so I can not see the Last Error for that thread...
Thanks n Regards,
Amit
|
|
|
|
|
Hi,
I forgot to mention one thing in earlier reply, I use AfxEndThread( ) function to kill the thread, and not TerminateThread( )...
May I ask u, What were the problems u were getting when u were using TerminateThread( ),
Does that AfxEndThread( )also creates same problem that were created by TerminateThread( )?
Thanks n Regards,
Amit.
|
|
|
|
|
Amit Mulay wrote:
May I ask u, What were the problems u were getting when u were using TerminateThread( ),
When your thread is allocated, it gets its stack space. In Win32, this defaults to 1MB, but can be changed. Since threads operate in your process' address space, the memory (address) for the thread's stack exists in your process space.
When a thread exits normally (it returns from its ThreadProc ), the memory area reserved for its stack gets returned back to your process. But if you kill the thread, it never gets cleaned up correctly, and that reserved address space remains unavailable.
Over time, this can consume your process' address space and will cause new threads to fail creation, or memory allocation to fail because even though free memory does exist, your process' memory area has no more available addresses (range) to map that memory in or to reserve for the thread's stack.
Think of it like being in a candy store, with plenty of money. You start buying candy and filling your pockets. You then eat the candy, but you put the empty candy wrappers back into your pocket. After a while, your pockets will be full of empty wrappers, and you cannot hold any more candy, even though more candy is available and you still have money to buy it. You just do not have the "space" for anymore because you did not "clean up" the wrappers, you kept them.
Amit Mulay wrote:
Does that AfxEndThread( )also creates same problem that were created by TerminateThread( )?
No, because it does not cause the thread to exit in the same way. Since this function is called from within the thread, the thread "knows" it is ending and cleans itself up (via endthreadex(...) ).
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hi,
I just tried with GetLastError( ) function, and found that the error number is 998 i.e. "Invalid Access to memory location". Its name is "ERROR_NOACCESS"
Thanks n Regards,
Amit.
|
|
|
|
|
My first guess would be that something got stepped on in either your address space or in the heap. ERROR_NOACCESS actually means that an exception (Access Violation) was encountered internally within an underlying function.
Try using that debug function I posted earlier and see if it can detect if anything is wrong. Not all overruns are detected by the debug heap, especially if the overrun happens AFTER the memory is deallocated.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Malloc or new doesn't fail unless your system is out of memory (which I doubt).
There are two things that can be going on:
1. Prior to allocating the memory, you have managed to trash your memory heap thus causing the call to fail. Try using _CrtCheckMemory before and after the call to malloc.
2. The malloc is actually working just fine, but due to other bugs in your code, the routine is failing and you are misdiagnosing the problem as an allocation failure. I see this happen very often. Usually by people who can't believe their software has bugs so they blame the compiler. However, experienced programmers do this to.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Tim Smith wrote:
Malloc or new doesn't fail unless your system is out of memory (which I doubt).
Or you are trying to allocate too much memory...
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Normally allocating memory is not affected by threads, since the whole thing is synchronized with a semaphore (critical section).
Try single-step debugging to check if the error comes from CRT code or from windows itself.
Don't try it, just do it!
|
|
|
|
|
Alexander M. wrote:
Normally allocating memory is not affected by threads, since the whole thing is synchronized with a semaphore (critical section).
[Pedantic Hat On]
Technically, it is affected, and it is because of the Critical Section used to synchronize access to the heap in the default runtime memory allocator. If multiple threads are abusing the heap, they will lock each other out from time-to-time, which will hinder performance.
[Pedantic Hat Off]
That is actually one of the reasons developers sometimes see a dramatic decrease in performance when they start using multiple threads - bad memory practices.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hello,
I was wondering, is there a way to retrieve the key associated with a value when you have only the iterator?
Lets take the following code example:
typedef std::map<int, std::string> MyMap;
MyMap map;
for( MyMap::iterator iter = map.begin();
iter !< map.end();
iter++;
{
}
Is this possible and if yes, how can I achieve this?
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
I see now that a map iterator contains both the key and the value in a pair... What a dumb question it was indeed...
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
<br />
typedef std::map<int, std::string> MyMap;<br />
MyMap myMap;<br />
<br />
for (int i=0; i<10;i++)<br />
myMap[i] = "Test";<br />
<br />
MyMap::iterator myIterator;<br />
<br />
for(myIterator = myMap.begin();myIterator != myMap.end();myIterator++)<br />
{<br />
int key = myIterator->first;<br />
string value = myIterator->second; <br />
}<br />
Hope this helps.
<bold>- Nilesh
<italics>"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
Nilesh K. wrote:
myIterator->first;
Thats what you get for not paying attention...
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
An iterator over a map contains a std::pair object. You can access the current map key by using iter->first, and the current map value by using iter->second.
Regards,
--Mike
|
|
|
|
|
Hi guys,
I tried to use POST to send string to a text box in the website.
But it return me an error, said "The server unable to implement the request"
.
What goes wrong? Need help and advice
thanx
|
|
|
|