[Gdal-dev] Re: GDAL Coding Guidelines
Marc Lepage
mlepage at pyxisinnovation.com
Wed May 31 16:05:20 EDT 2006
Threading isn't part of C either. And yet, as you mentioned, there are
thread-safe versions of printf. Why would streams be any different in
this regard...?
There's no inherent reason not to use streams. They offer a lot of type
safety and flexibility at little to no performance cost. Without
concrete performance measurements in this specific case, it's difficult
to argue against streams for hypothetical performance reasons when we
know they have tangible benefits in other respects.
FAQ [15.1] Why should I use <iostream> instead of the traditional
<cstdio>?
http://www.parashift.com/c++-faq-lite/input-output.html#faq-15.1
As in all cases, it depends on what you want to do. But I wouldn't
dismiss them out of hand or due to pre-conceptions.
-----Original Message-----
From: gdal-dev-bounces at lists.maptools.org
[mailto:gdal-dev-bounces at lists.maptools.org] On Behalf Of Chapman,
Martin
Sent: Wednesday, May 31, 2006 2:56 PM
To: Mateusz Loskot; gdal-dev at lists.maptools.org
Subject: RE: [Gdal-dev] Re: GDAL Coding Guidelines
Mateusz,
Thanks for the info. I didn't know that. I understood that threading
is not part of the C++ lib, but I didn't know that there were thread
safe versions of stl...cool.
Thanks,
Martin
-----Original Message-----
From: gdal-dev-bounces at lists.maptools.org
[mailto:gdal-dev-bounces at lists.maptools.org] On Behalf Of Mateusz Loskot
Sent: Wednesday, May 31, 2006 10:55 AM
To: gdal-dev at lists.maptools.org
Subject: Re: [Gdal-dev] Re: GDAL Coding Guidelines
Chapman, Martin wrote:
> I can think of a reason not to use streams. They're not thread safe.
> Printf() is thread safe though, if you properly create your threads.
> On windows you would use _beginthreadex() and _endthreadex().
> Please correct me if I'm wrong.
That's not exactly true.
Threading is not a part of C++ Language Standard.
It is an implementation detail, so if you need thread-safe STL, then you
have to use appropriate implementation of STL.
All widely used STL implementations like SGI STL, STLport, Dinkumware
(this impl. isshipped with Visual C++) provide single-thread and
multi-thread versions.
Cheers
--
Mateusz Loskot
http://mateusz.loskot.net
_______________________________________________
Gdal-dev mailing list
Gdal-dev at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/gdal-dev
_______________________________________________
Gdal-dev mailing list
Gdal-dev at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/gdal-dev
More information about the Gdal-dev
mailing list