[Gdal-dev] Re: GDAL Coding Guidelines

Mateusz Loskot mateusz at loskot.net
Wed May 31 16:49:31 EDT 2006


Marc Lepage wrote:
> 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.

Especially, when you can achive better safety (elimination of undefined
behaviour) with simple code.
Here is some interesting case study about it:

http://www.comeaucomputing.com/techtalk/#atoi

Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net



More information about the Gdal-dev mailing list