Click here to Skip to main content
15,907,497 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How can I find the total size of the text in pixels Pin
Roger Allen20-Jun-02 23:26
Roger Allen20-Jun-02 23:26 
GeneralProcess handle Pin
Kiddxin20-Jun-02 18:26
Kiddxin20-Jun-02 18:26 
GeneralRe: Process handle Pin
Mike Nordell20-Jun-02 18:40
Mike Nordell20-Jun-02 18:40 
GeneralRe: Process handle Pin
Nish Nishant20-Jun-02 19:44
sitebuilderNish Nishant20-Jun-02 19:44 
GeneralRe: Process handle Pin
sultan_of_6string20-Jun-02 23:21
sultan_of_6string20-Jun-02 23:21 
GeneralC++ run-time library Pin
pearothy20-Jun-02 18:12
pearothy20-Jun-02 18:12 
GeneralRe: C++ run-time library Pin
Michael Dunn20-Jun-02 18:39
sitebuilderMichael Dunn20-Jun-02 18:39 
GeneralRe: C++ run-time library Pin
Alex Cramer20-Jun-02 20:35
Alex Cramer20-Jun-02 20:35 
Additional info. Jeffrey Righter wrote:


When you implement any type of project, you must know which library you're linking your project with. You select a library using the Project Settings dialog box, shown below. On the C/C++ tab, in the Code Generation category, select one of the six options from the Use Run-Time Library combo box.

The first thing you're probably wondering is, "Why do I need one library for single-threaded applications and another library for multithreaded applications?" The reason is that the standard C run-time library was invented around 1970, long before threads were available on any operating system. The inventors of the library didn't consider the problems of using the C run-time library with multithreaded applications.

Consider the standard C run-time global variable errno. Some functions set this variable when an error occurs. Let's say you have the following code fragment:

BOOL fFailure = (system("NOTEPAD.EXE README.TXT") == -1);

if (fFailure) {
   switch (errno) {
   case E2BIG:   // Argument list or environment too big
      break;
   case ENOENT:  // Command interpreter cannot be found
      break;
   case ENOEXEC: // Command interpreter has bad format
      break;
   case ENOMEM:  // Insufficient memory to run command
      break;
   }
}

Now let's say that the thread executing the code above is interrupted after the call to the system function and before the if statement. And imagine that the thread is being interrupted to allow a second thread in the same process to execute and that this new thread will execute another C run-time function that sets the global variable errno. When the CPU is later assigned back to the first thread, the value of errno no longer reflects the proper error code for the call to system in the code above. To solve this problem, each thread requires its own errno variable. In addition, there must be some mechanism that allows a thread to reference its own errno variable but not touch another thread's errno variable.

This is only one example of how the standard C/C++ run-time library was not originally designed for multithreaded applications. The C/C++ run-time library variables and functions that have problems in multithreaded environments include errno, _doserrno, strtok, _wcstok, strerror, _strerror, tmpnam, tmpfile, asctime, _wasctime, gmtime, _ecvt, and _fcvt—to name just a few.

For multithreaded C and C++ programs to work properly, a data structure must be created and associated with each thread that uses C/C++ run-time library functions. Then, when you make C/C++ run-time library calls, those functions must know to look in the calling thread's data block so that no other thread is adversely affected.



You can download Righter's book here:
http://ganz2006.chat.ru/pamw4ejr.rar1
http://ganz2007.chat.ru/pamw4ejr.r00

These is two parts of WinRar archive (rename rar1->rar).
QuestionHow to select HTML element like in it made Find Dilog? Pin
Alex Cramer20-Jun-02 17:58
Alex Cramer20-Jun-02 17:58 
GeneralDebug assertion failed when I try to connect to IE Events Pin
Alex Cramer20-Jun-02 17:24
Alex Cramer20-Jun-02 17:24 
GeneralADO message error not understood Pin
20-Jun-02 17:02
suss20-Jun-02 17:02 
QuestionDialog in an DLL? Pin
Rene De La Garza20-Jun-02 16:40
Rene De La Garza20-Jun-02 16:40 
AnswerRe: Dialog in an DLL? Pin
Nish Nishant20-Jun-02 17:52
sitebuilderNish Nishant20-Jun-02 17:52 
GeneralRe: Dialog in an DLL? Pin
21-Jun-02 4:49
suss21-Jun-02 4:49 
GeneralRe: Dialog in an DLL? Pin
Michael P Butler21-Jun-02 6:19
Michael P Butler21-Jun-02 6:19 
AnswerRe: Dialog in an DLL? Pin
Michael P Butler21-Jun-02 6:29
Michael P Butler21-Jun-02 6:29 
GeneralResource Editor in Binary/Hex... Pin
Selevercin20-Jun-02 15:29
Selevercin20-Jun-02 15:29 
GeneralRe: Resource Editor in Binary/Hex... Pin
Christian Graus20-Jun-02 17:27
protectorChristian Graus20-Jun-02 17:27 
GeneralRe: Resource Editor in Binary/Hex... Pin
Mike Nordell20-Jun-02 18:44
Mike Nordell20-Jun-02 18:44 
GeneralRe: Resource Editor in Binary/Hex... Pin
Selevercin21-Jun-02 7:17
Selevercin21-Jun-02 7:17 
GeneralRe: Resource Editor in Binary/Hex... Pin
Mike Nordell21-Jun-02 11:17
Mike Nordell21-Jun-02 11:17 
Generaladdin/program that display dialog resource with resource_id Pin
aldeba20-Jun-02 15:28
aldeba20-Jun-02 15:28 
GeneralRe: addin/program that display dialog resource with resource_id Pin
aldeba20-Jun-02 15:32
aldeba20-Jun-02 15:32 
Generalunresizable dialog Pin
Steve L.20-Jun-02 15:11
Steve L.20-Jun-02 15:11 
GeneralRe: unresizable dialog Pin
Chris Losinger20-Jun-02 15:17
professionalChris Losinger20-Jun-02 15:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.