|
I m not going to sit and watch are there any error every time (since it's used for continuous integration ) i want something that should stop on it's own.
It's not enough to be the best, when you have capability to be great....
|
|
|
|
|
Pavan_Putra wrote: How is it possible that i can stop the build file as soon as any error in any project or solution occurs.
Is there such an option on devenv? What does the documentation say?
|
|
|
|
|
No they don't even talk about it.I had already gone through the documentation and other options there is no such option.
I think there is only one option that you can use, "/Out" parameter to save build log and later check if there were any errors in your build.
I have used the same as there is no option remaining any more.
It's not enough to be the best, when you have capability to be great....
|
|
|
|
|
Pavan_Putra wrote: I had already gone through the documentation and other options there is no such option.
That seems like your answer then. In my experience most of the autogenerated scripts in VS run to completion while logging errors, allowing you to review all the errors at the end of the build.
|
|
|
|
|
can you give examples program of arrays using C language.
|
|
|
|
|
You may find a lot of examples in any good C tutorial or book (even in bad ones, actually...).
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
[My articles]
|
|
|
|
|
|
in using array, you better read books in your library ok???
hahaha!!
|
|
|
|
|
Have a look at
http://msdn.microsoft.com/en-us/library/ts4c4dw6.aspx
http://www.cplusplus.com/doc/tutorial/arrays/
G.Paulraj
|
|
|
|
|
I create a new MFC class which derived from CEdit Ctrl with the WM_NCPAINT() message. I do nothing in OnNcPaint() method(But I want to do something in it). The Edit control has style of multiline, horizontal , vertical scroll. The scroll bars both are visible if I input enough character . But the problem is that if the edit control redrawed, the scroll bars both are invisible unless I input the character again. How can I keep the scroll bars visible all the time?
Thanks in advance.
|
|
|
|
|
HI all
I am Having list control with datas.
I need for every column a particular item need to coloured...The column can be varied
Kindly help me on this.
|
|
|
|
|
|
Hi,
I allocated a struct from a heap, the struct may be like this one:
struct abc{
int tmp1;
string tmp2;
int tmp3;
}*pabc;
pabc=(abc*)malloc(sizeof abc);
And when I initialize the string(pabc->tmp2="1234"), an "Illegal Pointer" exception occured.
It seems that the size of the string is changed, so I decided to allocate a bigger size.
pabc=(abc*)malloc(sizeof abc+4);
But the error still exists.
sizeof(string("1234")) seems to be 8 instead of 4.
Can anyone help me with this problem?
modified on Sunday, November 22, 2009 11:46 PM
|
|
|
|
|
tyftyftyf wrote: abc->tmp2="1234"
Shouldn't this be pabc->tmp2="1234"
sizeof(string) will give you the size of the internal pointers/counters maintained by the string class.
To get the size of the string use its size() method.
modified on Sunday, November 22, 2009 10:42 PM
|
|
|
|
|
I'm really sorry i mistyped this. And the problem is probably solved by using a pointer to string instead of the string itself.
But I'm still confused about the size problem, for example, a string with 4 characters actually use 8 bytes in memory.Maybe a string contains other parameter variables, not just pure characters.
|
|
|
|
|
Try sizeof(string("abcdefghijklmnopqrstuvwxyz"));
This should also give you 8.
|
|
|
|
|
I see, the string probably itself has a pointer to an array of char.
And I solve the problem by adding:
memset(pabc,0,sizeof(abc));
I realized when using malloc, the memory is not cleared, so the pointer inside the string architect is just a mess, but when setting a value for string, the program found the string struncture is not all zero and considered that the string is already initialized so the program just change the value of the array of char that pointer pointed to.Ofcourse that pointer is just a mess, so "illegal pointer" occured.
If I clear the memory first, the pointer is just zero, so program will initialize it first.
Forgive my poor english....
Thanks!
|
|
|
|
|
As Superman mentioned sizeof(string) returns size of string class and it will return 16 for ANSI and 32 for UNICODE.
In your structure one of a member is a string and you do not know what string size would be until you assign a characters to it.
You are also facing another issue, that you have probably experience. Assigning string to member of pabc structure will cause exception, since you are merely reserving block of memory (including memory for a string) and as a result string member of the abc is not initialized because string constructor is never called.
There is remedy for that but...
pabc = (abc*)malloc(sizeof abc);
memcpy(&pabc->tmp2, &string(), sizeof(string));
pabc->tmp2 = "1234***************************";
Much better and safer is to allocate memory on the heap is to use "new" operator. This will assure that string’s constructor is called and string is properly initialized
pabc = new abc();
pabc->tmp2 = "1234***************************";
Much simpler.
Out of curiosity if you are using MFC why using std string instead of CString class?
JohnCz
MS C++ MVP
modified on Monday, November 23, 2009 10:32 AM
|
|
|
|
|
I see, I should copy a constructed null string first right? I used malloc because I was dealing with a multi-thread program, the thread which allocated and initialized the structure will die far before the structure is useless and should be deleted.So I'm consider using one thread allocate it, and another thread dispose it.
But C++ only allow "new" operator disposing a memory from a thread's local heap.So I used Windows API HeapAlloc and HeapFree, those two can allow two threads allocate and dispose memory from a same heap.
Then I encountered this initializing string problem.To make the code simpler, I wrote malloc instead of HeapAlloc, afterward I found out that these two are almost the same in single thread mode.
I guess I'm still just a beginner in C++.
ps: That program is a console, not MFC. I'd like to use BCB to design GUI. I'm still pretty confused about Windows Messages.
Thanks a lot.
|
|
|
|
|
I have edited my previous post, since code demonstrating new usage was the same (copying I guess).
I do not know if what tool you are using to write your programs. If MSVC and you are using multithreaded runtime libraries, using new is thread safe.
I do not know what function you are using to create thread. Nevertheless if you are concern about memory allocation, allocate your structure in a main thread and pass it as a parameter to a worker thread. After thread terminates, delete object.
I think using new to allocate object is much safer than using other allocation calls.
If you are serious about Windows programming I would suggest writing small Win32 application and see what window procedure does. There is nothing to be confused about windows messages, once you grasp the idea of message loop, dispatching and handling messages. Borland doe not shield you from Windows messages.
I would stay with MS tools and after familiarizing with Windows insides I would suggest using MFC. You can use other higher level languages and packages but they are using separate framework to allow application to run on Windows and make Windows insides transparent to a programmer.
JohnCz
MS C++ MVP
|
|
|
|
|
It was really wierd that new operator's proformance is much lower than HeapAlloc when more than ten threads are allocating memory form different heaps. Maybe new operator is using a mutex lock to prevent allocation errors in MSVC. The "heap concept" is hidden in new operator and I cannot free a memory from another thread, the DbgMsg shows that the "delete" operator can only free a memory from a thread's "local" heap. But HeapAlloc(Win API) allow choosing which heap to manipulate, so I eventually chose HeapAlloc.
Although I like it better when Message Dispatching and handling is hidden to programmer(I don't need to care about the details, source code is hidden, C++ CLR also have this "hallmark"), but message is the basis of window programming after all. I need to know the basic thing(maybe this is why the 'F' in "MFC" is "foundation").
I've really learned a lot, Thanks again!
|
|
|
|
|
You are welcome.
Treat messages like codes. Windows OS or other windows send messages to inform what is going on and may interest window. Like WM_MOUSEMOVE means mouse is mowing over you window and cursor position id 20, 340.
User selected item in a drop box: Hey, parent selection changed!
Messages are delivered to a thread message queue (LILO) by PostMessage and dispatched from message loop in WinMain.
Others are delivered by directly calling window procedure (Send message).
Some of them carry additional information as parameters some do not.
In VS create basic Win32 application with “Hello world” option and everything will be clear.
If you have any questions regarding API based application, post it here.
Once you understand at list basics you can switch to MFC. Remember MFC does not wrap all Windows API calls therefore knowing Windows will help.
Good Luck.
JohnCz
MS C++ MVP
|
|
|
|
|
hi,i would like to ask.. if the running time of java programs was more difficult to analyze,than c programs????
|
|
|
|
|
Assuming that both Java and C have functions to capture the time then there should be no difference. Maybe you should try it first.
|
|
|
|
|
yah, maybe i should have to!!!
running time includes fetching and storing..right?
|
|
|
|