help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can single-threaded gcc be used for writing multi-threaded apps?


From: Viatly
Subject: Re: Can single-threaded gcc be used for writing multi-threaded apps?
Date: Thu, 17 Jan 2008 14:28:47 -0800 (PST)
User-agent: G2/1.0

On Jan 17, 10:34 pm, arahne <ara...@arahne.si> wrote:
> Viatly wrote:
> > I 'd like to know whether single-threaded gcc can be used for:
> > 1. Writing multithreaded C app ( gcc file.c -pthread ).
> > 2. Writing multithreaded C++ app ( g++ file.cpp -pthread ).
>
> Short answer: YES.

However the fact that gcc is single-threaded means that gcc was build
with --enable-threads option off; this option enables C++ exception
handling for multi-threaded code. Does it mean that I should not use
exceptions in C++ code? But even if I don't myself, some parts of the
standard library could do it, e.g. new() throws  bad_alloc.
Also, how could you comment this:
[citation]
4. All C++ code compiled by gcc 3.X configured with --disable-threads.
   The final program is actually multi-threaded.

Undetectably broken.  It might work, or it might not, on any
particular run.  The most basic problem is that C++ exception handling
will not work properly.  Up the stack from there, standard C++ library
resources might get trashed.
[/citation]
Citated from http://gcc.gnu.org/ml/libstdc++/2001-10/msg00024.html


reply via email to

[Prev in Thread] Current Thread [Next in Thread]